Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/twbs/rewire.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
path: root/lib
diff options
context:
space:
mode:
authorJohannes Ewald <johannes.ewald@peerigon.com>2014-05-20 15:21:01 +0400
committerJohannes Ewald <johannes.ewald@peerigon.com>2014-05-20 15:21:01 +0400
commit4551fd830d5e8719424c1b96940e8b89643380fd (patch)
tree1136a8af4ba675e32e20d32f1d1d17ba1de91eab /lib
parent5560d14bbe57aca6a5a5be55da2a08655e4ab1ab (diff)
Added fix for node 0.11.x tests
Diffstat (limited to 'lib')
-rw-r--r--lib/getImportGlobalsSrc.js12
1 files changed, 7 insertions, 5 deletions
diff --git a/lib/getImportGlobalsSrc.js b/lib/getImportGlobalsSrc.js
index 8ed8545..66e69b1 100644
--- a/lib/getImportGlobalsSrc.js
+++ b/lib/getImportGlobalsSrc.js
@@ -14,15 +14,17 @@ function getImportGlobalsSrc(ignore) {
globalObj = typeof global === "undefined"? window: global;
ignore = ignore || [];
+ // global itself can't be overridden because it's the only reference to our real global objects
+ ignore.push("global");
- for (key in globalObj) {
- if (key !== "global" && ignore.indexOf(key) === -1) { // we don't use hasOwnProperty here because in some browsers not all global objects will be enumerated
- value = globalObj[key];
- src += "var " + key + " = global." + key + "; ";
+ for (key in globalObj) { /* jshint forin: false */
+ if (ignore.indexOf(key) !== -1) {
+ continue;
}
+ value = globalObj[key];
+ src += "var " + key + " = global." + key + "; ";
}
-
return src;
}