detect-amd

detect amd support from JavaScript source code

npm install detect-amd
1 downloads in the last week
6 downloads in the last month

Detect AMD

Detects AMD support from JavaScript source files.

Examples

var detect = require('detect-amd');

detect('foo = {};');
// false

detect("define('foo', ['./bar', 'baz'], function(){});");
// { deps: [ './bar', 'baz' ],
//   id: 'foo',
//   hasRelativeDeps: true }

detect.fromFile('jquery.js');
// { deps: [],
//   id: 'jquery',
//   hasRelativeDeps: false }

detect.fromFile('angular.js');
// false

detect.fromFile('ember.js');
// false

var esprima = require('esprima');
detect.fromAst(esprima.parse('define(function() {});'));
npm loves you