Skip to content

Instantly share code, notes, and snippets.

@joelgriffith
Last active August 29, 2015 13:55
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save joelgriffith/8744874 to your computer and use it in GitHub Desktop.
Save joelgriffith/8744874 to your computer and use it in GitHub Desktop.
The End-all JavaScript Module Wrapper
/*
* The end-all module detection/exportation
*/
(function(base, factory) {
// RequireJS
if (typeof define === "function" && define.amd) {
define(factory);
// CommonJS
} else if (typeof exports === "object") {
module.exports = factory();
// Global Space
} else {
base.yourModule = factory();
}
}(this, function() {
var yourModule = {
/*
*Your code/functionality here
*/
};
return someModule;
}));
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment