Skip to content

Instantly share code, notes, and snippets.

@matthewrobb
Created August 18, 2014 16:09
Show Gist options
  • Save matthewrobb/1cfd9e10f8d70d4fb524 to your computer and use it in GitHub Desktop.
Save matthewrobb/1cfd9e10f8d70d4fb524 to your computer and use it in GitHub Desktop.

Revisions

  1. matthewrobb created this gist Aug 18, 2014.
    18 changes: 18 additions & 0 deletions exports.js
    Original file line number Diff line number Diff line change
    @@ -0,0 +1,18 @@
    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__;
    }