diff --git a/lib/wasi.js b/lib/wasi.js index efe24e0ad7a2ee..eef36d24d487e7 100644 --- a/lib/wasi.js +++ b/lib/wasi.js @@ -25,13 +25,11 @@ class WASI { if (options === null || typeof options !== 'object') throw new ERR_INVALID_ARG_TYPE('options', 'object', options); - // eslint-disable-next-line prefer-const - let { args, env, preopens } = options; + const { env, preopens } = options; + let { args = [] } = options; if (ArrayIsArray(args)) args = ArrayPrototypeMap(args, (arg) => { return String(arg); }); - else if (args === undefined) - args = []; else throw new ERR_INVALID_ARG_TYPE('options.args', 'Array', args);