Skip to content

Commit

Permalink
lib: use validateArray
Browse files Browse the repository at this point in the history
The `validateArray()` validator could be used to cleanup validation
and keep consistency.

PR-URL: #39774
Reviewed-By: James M Snell <[email protected]>
Reviewed-By: Tobias Nießen <[email protected]>
Reviewed-By: Luigi Pinca <[email protected]>
Reviewed-By: Zijian Liu <[email protected]>
Reviewed-By: Khaidi Chu <[email protected]>
Reviewed-By: Qingyu Deng <[email protected]>
  • Loading branch information
VoltrexKeyva authored and targos committed Oct 4, 2021
1 parent a1bee94 commit 547fc86
Showing 1 changed file with 3 additions and 6 deletions.
9 changes: 3 additions & 6 deletions lib/internal/worker.js
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
'use strict';

const {
ArrayIsArray,
ArrayPrototypeForEach,
ArrayPrototypeMap,
ArrayPrototypePush,
Expand Down Expand Up @@ -122,11 +121,9 @@ class Worker extends EventEmitter {
constructor(filename, options = {}) {
super();
debug(`[${threadId}] create new worker`, filename, options);
if (options.execArgv && !ArrayIsArray(options.execArgv)) {
throw new ERR_INVALID_ARG_TYPE('options.execArgv',
'Array',
options.execArgv);
}
if (options.execArgv)
validateArray(options.execArgv, 'options.execArgv');

let argv;
if (options.argv) {
validateArray(options.argv, 'options.argv');
Expand Down

0 comments on commit 547fc86

Please sign in to comment.