Skip to content

Instantly share code, notes, and snippets.

@wmakeev
Created August 21, 2014 15:34
Show Gist options
  • Save wmakeev/8da71dec5a32a2335f06 to your computer and use it in GitHub Desktop.
Save wmakeev/8da71dec5a32a2335f06 to your computer and use it in GitHub Desktop.
Universal Module Definition
(function (root, factory) {
if (typeof exports === 'object') {
// CommonJS
module.exports = factory(require('b'));
} else if (typeof define === 'function' && define.amd) {
// AMD
define(['b'], function (b) {
return (root.returnExportsGlobal = factory(b));
});
} else {
// Global Variables
root.returnExportsGlobal = factory(root.b);
}
}(this, function (b) {
// Your actual module
return {};
}));
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment