Skip to content

Instantly share code, notes, and snippets.

@matthewrobb
Created August 18, 2014 16:09
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 matthewrobb/1cfd9e10f8d70d4fb524 to your computer and use it in GitHub Desktop.
Save matthewrobb/1cfd9e10f8d70d4fb524 to your computer and use it in GitHub Desktop.
Universal Module Exports
function createUMEModule(values) {
function __ume__() {
return typeof values.default !== "function" ? values.default : values.default.apply(this, arguments);
}
Object.keys(values).forEach(function(name) {
Object.defineProperty(__ume__, name, {
enumerable: true,
configurable: false,
get: function() {
return values[name];
}
});
});
return __ume__;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment