Skip to content

Commit

Permalink
wasi: refactor destructuring object on constructor
Browse files Browse the repository at this point in the history
PR-URL: #31185
Reviewed-By: Anna Henningsen <[email protected]>
Reviewed-By: Rich Trott <[email protected]>
Reviewed-By: Yongsheng Zhang <[email protected]>
Reviewed-By: Anto Aravinth <[email protected]>
Reviewed-By: Ruben Bridgewater <[email protected]>
Reviewed-By: Jiawen Geng <[email protected]>
Reviewed-By: Colin Ihrig <[email protected]>
Reviewed-By: Trivikram Kamat <[email protected]>
Reviewed-By: David Carlier <[email protected]>
Reviewed-By: Luigi Pinca <[email protected]>
  • Loading branch information
himself65 authored and targos committed Jan 6, 2020
1 parent 5fccb50 commit 614b074
Showing 1 changed file with 2 additions and 4 deletions.
6 changes: 2 additions & 4 deletions lib/wasi.js
Original file line number Diff line number Diff line change
Expand Up @@ -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);

Expand Down

0 comments on commit 614b074

Please sign in to comment.