Created
August 18, 2014 16:09
-
-
Save matthewrobb/1cfd9e10f8d70d4fb524 to your computer and use it in GitHub Desktop.
Universal Module Exports
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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