Skip to content
This repository was archived by the owner on Sep 9, 2024. It is now read-only.
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 3 additions & 6 deletions eval.js
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,9 @@ var requireLike = require('require-like')

function merge (a, b) {
if (!a || !b) return a
var keys = Object.keys(b)
// Include all non-enumerable variables, including console (v10+),
// process (v12+), URL, etc.
var keys = Object.getOwnPropertyNames(b)
for (var k, i = 0, n = keys.length; i < n; i++) {
k = keys[i]
a[k] = b[k]
Expand Down Expand Up @@ -36,11 +38,6 @@ module.exports = function (content, filename, scope, includeGlobals) {

if (includeGlobals) {
merge(sandbox, global)
// console is non-enumerable in node v10 and above
sandbox.console = global.console
// process is non-enumerable in node v12 and above
sandbox.process = global.process
sandbox.URL = global.URL
sandbox.require = requireLike(_filename)
}

Expand Down