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

Commit 83f6984

Browse files
committed
faster newModule
1 parent 2e17f6c commit 83f6984

File tree

1 file changed

+3
-11
lines changed

1 file changed

+3
-11
lines changed

src/loader.js

Lines changed: 3 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -740,19 +740,14 @@ function logloads(loads) {
740740
if (typeof obj != 'object')
741741
throw new TypeError('Expected object');
742742

743-
// we do this to be able to tell if a module is a module privately in ES5
744-
// by doing m instanceof Module
745743
var m = new Module();
746744

747-
var pNames;
748-
if (Object.getOwnPropertyNames && obj != null) {
745+
var pNames = [];
746+
if (Object.getOwnPropertyNames && obj != null)
749747
pNames = Object.getOwnPropertyNames(obj);
750-
}
751-
else {
752-
pNames = [];
748+
else
753749
for (var key in obj)
754750
pNames.push(key);
755-
}
756751

757752
for (var i = 0; i < pNames.length; i++) (function(key) {
758753
defineProperty(m, key, {
@@ -764,9 +759,6 @@ function logloads(loads) {
764759
});
765760
})(pNames[i]);
766761

767-
if (Object.preventExtensions)
768-
Object.preventExtensions(m);
769-
770762
return m;
771763
},
772764
// 26.3.3.14

0 commit comments

Comments
 (0)