Skip to content
Get the type of AMD module used for an AST node or within a file
JavaScript
Branch: master
Clone or download
Fetching latest commit…
Cannot retrieve the latest commit at this time.

Files

Permalink
Type Name Latest commit message Commit time
Failed to load latest commit information.
test
.gitignore
.npmignore
.travis.yml
Readme.md
index.js
package.json

Readme.md

get-amd-module-type npm npm

Get the type of AMD module used for an AST node or within a file

npm install get-amd-module-type

Usage

var getType = require('get-amd-module-type');

// Async
getType('my/file.js', function(err, type) {

});

// Sync
var type = getType.sync('my/file.js');

// From source code
var type = getType.fromSource('define() {}');

// From an AST node
var type = getType.fromAST(node);

The returned type will be any of the following:

  • 'named': define('name', [deps], func)
  • 'deps': define([deps], func)
  • 'rem': define(function(require, exports, module){});
  • 'factory': define(function(require){})
  • 'nodeps': define({})
  • 'driver': require([deps], function)
You can’t perform that action at this time.