Skip to content

Instantly share code, notes, and snippets.

@zsitro
Last active August 29, 2015 13:57
Show Gist options
  • Save zsitro/9627256 to your computer and use it in GitHub Desktop.
Save zsitro/9627256 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