Skip to content

Instantly share code, notes, and snippets.

@tgvashworth
Created September 5, 2013 16:15
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 tgvashworth/6452380 to your computer and use it in GitHub Desktop.
Save tgvashworth/6452380 to your computer and use it in GitHub Desktop.
(function (scope, name, fn, map) {
if (typeof define === 'function' && define.amd) {
define(fn)
} else if (typeof exports === 'object') {
var rtn = fn(require, module.exports, module);
if (module.exports !== rtn &&
typeof rtn !== 'undefined') module.exports = rtn;
} else {
var exp = {}, mod = { exports: exp },
reqr = function (i) { return map[i] ? scope[map[i]] : scope[i]; };
var rtn = fn(reqr, scope[name]=exp, mod);
if (mod.exports !== scope[name]) scope[name] = mod.exports;
else if (typeof rtn !== 'undefined') scope[name] = rtn;
}
})(this, 'my-module', function () {}, {});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment