blob: 1bcfed47e9b31e9e7afb4f75652bbcdc1415f5eb (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
|
"use strict"; // run code in ES5 strict mode
/**
* 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() {
var key,
value,
src = "";
for (key in global) {
if (global.hasOwnProperty(key) && key !== "global") {
value = global[key];
src += "var " + key + " = global." + key + "; ";
}
}
return src;
}
module.exports = getImportGlobalsSrc;
|