Have ideas to improve npm?Join in the discussion! »

get-amd-module-type

3.0.0 • Public • Published

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)

Install

npm i get-amd-module-type

DownloadsWeekly Downloads

323,813

Version

3.0.0

License

MIT

Unpacked Size

4.1 kB

Total Files

3

Last publish

Collaborators

  • avatar