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

Commit 57675e9

Browse files
committed
support non-enumerable properties in module construction (systemjs/systemjs#393)
1 parent 24f6e5e commit 57675e9

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
@@ -1019,18 +1019,26 @@ function logloads(loads) {
10191019
// by doing m instanceof Module
10201020
var m = new Module();
10211021

1022-
for (var key in obj) {
1023-
(function (key) {
1024-
defineProperty(m, key, {
1025-
configurable: false,
1026-
enumerable: true,
1027-
get: function () {
1028-
return obj[key];
1029-
}
1030-
});
1031-
})(key);
1022+
var pNames;
1023+
if (Object.getOwnPropertyNames) {
1024+
pNames = Object.getOwnPropertyNames(obj);
1025+
}
1026+
else {
1027+
pNames = [];
1028+
for (var key in obj)
1029+
pNames.push(key);
10321030
}
10331031

1032+
for (var i = 0; i < pNames.length; i++) (function(key) {
1033+
defineProperty(m, key, {
1034+
configurable: false,
1035+
enumerable: true,
1036+
get: function () {
1037+
return obj[key];
1038+
}
1039+
});
1040+
})(pNames[i]);
1041+
10341042
if (Object.preventExtensions)
10351043
Object.preventExtensions(m);
10361044

0 commit comments

Comments
 (0)