Detect AMD support in JavaScript source files
JavaScript
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Failed to load latest commit information.
lib
test
.npmignore
LICENSE
README.md
index.js
package.json

README.md

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() {});'));