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
diff options
context:
space:
mode:
authorJohannes <johannes.ewald@roomieplanet.de>2012-07-10 22:32:54 +0400
committerJohannes <johannes.ewald@roomieplanet.de>2012-07-10 22:32:54 +0400
commit0bb70adf091ce5ccf8c81f28cc72a229ac15eba1 (patch)
tree61ef88ea9646dd734533e295d7002653c311508e /lib/getImportGlobalsSrc.js
parentb443c61ab73679410f083e383be7aef3039d228f (diff)
- fixed parsing error when trying to set a function as mockv0.3.2
- update to mocha 1.3.x - fixed minor IE issues
Diffstat (limited to 'lib/getImportGlobalsSrc.js')
-rw-r--r--lib/getImportGlobalsSrc.js58
1 files changed, 28 insertions, 30 deletions
diff --git a/lib/getImportGlobalsSrc.js b/lib/getImportGlobalsSrc.js
index f8c73c2..0e573f2 100644
--- a/lib/getImportGlobalsSrc.js
+++ b/lib/getImportGlobalsSrc.js
@@ -1,31 +1,29 @@
-/**
- * Declares all globals with a var and assigns the global object. Thus you're able to
- * override globals without changing the global object itself.
- *
- * Returns something like
- * "var console = console; var process = process; ..."
- *
- * @return {String}
- */
-function getImportGlobalsSrc(ignore) {
- var key,
- value,
- src = "",
- globalObj = typeof global === "undefined"? window: global;
-
- ignore = ignore || [];
-
- for (key in globalObj) {
- if (globalObj.hasOwnProperty === undefined || globalObj.hasOwnProperty(key)) { // in IE8 window.hasOwnProperty is undefined
- if (key !== "global" && ignore.indexOf(key) === -1) {
- value = globalObj[key];
- src += "var " + key + " = global." + key + "; ";
- }
- }
- }
-
-
- return src;
-}
-
+/**
+ * Declares all globals with a var and assigns the global object. Thus you're able to
+ * override globals without changing the global object itself.
+ *
+ * Returns something like
+ * "var console = console; var process = process; ..."
+ *
+ * @return {String}
+ */
+function getImportGlobalsSrc(ignore) {
+ var key,
+ value,
+ src = "",
+ globalObj = typeof global === "undefined"? window: global;
+
+ ignore = ignore || [];
+
+ 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 + "; ";
+ }
+ }
+
+
+ return src;
+}
+
module.exports = getImportGlobalsSrc; \ No newline at end of file