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

Commit

Permalink
faster newModule
Browse files Browse the repository at this point in the history
  • Loading branch information
guybedford committed Oct 9, 2015
1 parent 2e17f6c commit 83f6984
Showing 1 changed file with 3 additions and 11 deletions.
14 changes: 3 additions & 11 deletions src/loader.js
Expand Up @@ -740,19 +740,14 @@ function logloads(loads) {
if (typeof obj != 'object')
throw new TypeError('Expected object');

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

var pNames;
if (Object.getOwnPropertyNames && obj != null) {
var pNames = [];
if (Object.getOwnPropertyNames && obj != null)
pNames = Object.getOwnPropertyNames(obj);
}
else {
pNames = [];
else
for (var key in obj)
pNames.push(key);
}

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

if (Object.preventExtensions)
Object.preventExtensions(m);

return m;
},
// 26.3.3.14
Expand Down

0 comments on commit 83f6984

Please sign in to comment.