AMD (Asynchronous Module Definition) support for node.js, specifically define()
JavaScript
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Permalink
Failed to load latest commit information.
examples
lib
README.md
package.json

README.md

AMD

Asynchronous Module Definition support for node (a.k.a. define())

See /examples.

Install

npm install AMD

Example1

// bar.js
if (typeof module !== 'undefined' && "exports" in module && typeof define !== 'function') {
    var define = require('AMD').define;
}

define(['http','path','fs'],function(http,path,fs) {
    return {
        hello: 'world'
    };
});

Example2

// baz.js
if (typeof module !== 'undefined' && "exports" in module && typeof define !== 'function') {
    var define = require('AMD').define;
}

define({
    wtf: 'yeehaw'
});

Module use is seamless

console.log(require('./bar'));
console.log(require('./baz'));