diff options
Diffstat (limited to 'lib/vm.js')
-rw-r--r-- | lib/vm.js | 15 |
1 files changed, 9 insertions, 6 deletions
@@ -21,7 +21,10 @@ 'use strict'; -const { Array, ArrayPrototype } = primordials; +const { + ArrayIsArray, + ArrayPrototypeForEach, +} = primordials; const { ContextifyScript, @@ -309,11 +312,11 @@ function runInThisContext(code, options) { function compileFunction(code, params, options = {}) { validateString(code, 'code'); if (params !== undefined) { - if (!Array.isArray(params)) { + if (!ArrayIsArray(params)) { throw new ERR_INVALID_ARG_TYPE('params', 'Array', params); } - ArrayPrototype.forEach(params, - (param, i) => validateString(param, `params[${i}]`)); + ArrayPrototypeForEach(params, + (param, i) => validateString(param, `params[${i}]`)); } const { @@ -356,14 +359,14 @@ function compileFunction(code, params, options = {}) { ); } } - if (!Array.isArray(contextExtensions)) { + if (!ArrayIsArray(contextExtensions)) { throw new ERR_INVALID_ARG_TYPE( 'options.contextExtensions', 'Array', contextExtensions ); } - ArrayPrototype.forEach(contextExtensions, (extension, i) => { + ArrayPrototypeForEach(contextExtensions, (extension, i) => { if (typeof extension !== 'object') { throw new ERR_INVALID_ARG_TYPE( `options.contextExtensions[${i}]`, |