The untransformed `let` keyword causes problems for older parsers. I understand using `let` instead of `var` ensures each getter function has its own binding for the KEY variable, but the same can be accomplished (with less code) using a `.forEach` callback function, and this way there's no need to worry about generating a unique name for the `key` variable.
71 lines
1.5 KiB
JavaScript
71 lines
1.5 KiB
JavaScript
(function (global, factory) {
|
|
if (typeof define === "function" && define.amd) {
|
|
define(["exports", "foo"], factory);
|
|
} else if (typeof exports !== "undefined") {
|
|
factory(exports, require("foo"));
|
|
} else {
|
|
var mod = {
|
|
exports: {}
|
|
};
|
|
factory(mod.exports, global.foo);
|
|
global.actual = mod.exports;
|
|
}
|
|
})(this, function (exports, _foo) {
|
|
"use strict";
|
|
|
|
Object.defineProperty(exports, "__esModule", {
|
|
value: true
|
|
});
|
|
Object.keys(_foo).forEach(function (key) {
|
|
if (key === "default") return;
|
|
Object.defineProperty(exports, key, {
|
|
enumerable: true,
|
|
get: function () {
|
|
return _foo[key];
|
|
}
|
|
});
|
|
});
|
|
Object.defineProperty(exports, "foo", {
|
|
enumerable: true,
|
|
get: function () {
|
|
return _foo.foo;
|
|
}
|
|
});
|
|
Object.defineProperty(exports, "foo", {
|
|
enumerable: true,
|
|
get: function () {
|
|
return _foo.foo;
|
|
}
|
|
});
|
|
Object.defineProperty(exports, "bar", {
|
|
enumerable: true,
|
|
get: function () {
|
|
return _foo.bar;
|
|
}
|
|
});
|
|
Object.defineProperty(exports, "bar", {
|
|
enumerable: true,
|
|
get: function () {
|
|
return _foo.foo;
|
|
}
|
|
});
|
|
Object.defineProperty(exports, "default", {
|
|
enumerable: true,
|
|
get: function () {
|
|
return _foo.foo;
|
|
}
|
|
});
|
|
Object.defineProperty(exports, "default", {
|
|
enumerable: true,
|
|
get: function () {
|
|
return _foo.foo;
|
|
}
|
|
});
|
|
Object.defineProperty(exports, "bar", {
|
|
enumerable: true,
|
|
get: function () {
|
|
return _foo.bar;
|
|
}
|
|
});
|
|
});
|