mirror of
https://github.com/nodejs/node.git
synced 2026-11-25 23:01:06 -05:00
wasi: refactor destructuring object on constructor
PR-URL: https://github.com/nodejs/node/pull/31185 Reviewed-By: Anna Henningsen <anna@addaleax.net> Reviewed-By: Rich Trott <rtrott@gmail.com> Reviewed-By: Yongsheng Zhang <zyszys98@gmail.com> Reviewed-By: Anto Aravinth <anto.aravinth.cse@gmail.com> Reviewed-By: Ruben Bridgewater <ruben@bridgewater.de> Reviewed-By: Jiawen Geng <technicalcute@gmail.com> Reviewed-By: Colin Ihrig <cjihrig@gmail.com> Reviewed-By: Trivikram Kamat <trivikr.dev@gmail.com> Reviewed-By: David Carlier <devnexen@gmail.com> Reviewed-By: Luigi Pinca <luigipinca@gmail.com>
This commit is contained in:
1 parent
5fccb508e9
commit
614b074f3b
1 file changed
+2
-4
+2
-4
@@ -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);
|
||||
|
||||
|
||||
Reference in new issue
Block a user