|
|
@ -18,8 +18,7 @@ const protectedproperties = (() => Object |
|
|
|
)(); |
|
|
|
|
|
|
|
// Sets up global browser environment
|
|
|
|
module.exports = function browserEnv() { |
|
|
|
|
|
|
|
const browserEnv = function () { |
|
|
|
// Extract options from args
|
|
|
|
const args = Array.from(arguments); |
|
|
|
const properties = args.filter(arg => Array.isArray(arg))[0]; |
|
|
@ -38,8 +37,12 @@ module.exports = function browserEnv() { |
|
|
|
.filter(prop => !(properties && properties.indexOf(prop) === -1)) |
|
|
|
|
|
|
|
// Copy what's left to the Node.js global scope
|
|
|
|
.forEach(prop => global[prop] = window[prop]); |
|
|
|
.forEach(prop => { |
|
|
|
global[prop] = window[prop]; |
|
|
|
}); |
|
|
|
|
|
|
|
// Return reference to original window object
|
|
|
|
return window; |
|
|
|
}; |
|
|
|
|
|
|
|
module.exports = browserEnv; |
|
|
|