Created
October 12, 2015 06:57
-
-
Save Gerhut/aca65ae16163705dcc67 to your computer and use it in GitHub Desktop.
AMD to CommonJS Module
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| var define = function (global) { | |
| function define(id, dependencies, factory) { | |
| if (typeof id == 'function') { // define(factory) | |
| factory = id | |
| dependencies = [] | |
| } else if (typeof dependencies == 'function') { // define(?, factory) | |
| factory = dependencies | |
| dependencies = (typeof id == 'string') ? [] : id | |
| } | |
| for (var i = 0, l = dependencies.length; i < l; i++) { | |
| dependencies[i] = require(dependencies[i]) | |
| } | |
| module.exports = factory.apply(global, dependencies) | |
| } | |
| define.amd = true | |
| return define | |
| } (new Function('return this')()) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment