Skip to content
This repository was archived by the owner on Jul 13, 2020. It is now read-only.

Commit ab58d4b

Browse files
committed
support non-enumerable properties in module construction (systemjs/systemjs#393)
1 parent 1e96b8c commit ab58d4b

File tree

1 file changed

+18
-10
lines changed

1 file changed

+18
-10
lines changed

src/loader.js

Lines changed: 18 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -724,18 +724,26 @@ function logloads(loads) {
724724
// by doing m instanceof Module
725725
var m = new Module();
726726

727-
for (var key in obj) {
728-
(function (key) {
729-
defineProperty(m, key, {
730-
configurable: false,
731-
enumerable: true,
732-
get: function () {
733-
return obj[key];
734-
}
735-
});
736-
})(key);
727+
var pNames;
728+
if (Object.getOwnPropertyNames) {
729+
pNames = Object.getOwnPropertyNames(obj);
730+
}
731+
else {
732+
pNames = [];
733+
for (var key in obj)
734+
pNames.push(key);
737735
}
738736

737+
for (var i = 0; i < pNames.length; i++) (function(key) {
738+
defineProperty(m, key, {
739+
configurable: false,
740+
enumerable: true,
741+
get: function () {
742+
return obj[key];
743+
}
744+
});
745+
})(pNames[i]);
746+
739747
if (Object.preventExtensions)
740748
Object.preventExtensions(m);
741749

0 commit comments

Comments
 (0)