From fa9ee0d3e2f01259828ecf3c225c85981c56bbae Mon Sep 17 00:00:00 2001 From: himself65 Date: Sat, 4 Jan 2020 11:49:31 +0800 Subject: [PATCH] wasi: refactor destructuring object on constructor --- lib/wasi.js | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/lib/wasi.js b/lib/wasi.js index ff8685cbb06452..cf25cd922660d5 100644 --- a/lib/wasi.js +++ b/lib/wasi.js @@ -26,13 +26,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);