Skip to content

Commit 547fc86

Browse files
VoltrexKeyvatargos
authored andcommitted
lib: use validateArray
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]>
1 parent a1bee94 commit 547fc86

File tree

1 file changed

+3
-6
lines changed

1 file changed

+3
-6
lines changed

lib/internal/worker.js

+3-6
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,6 @@
11
'use strict';
22

33
const {
4-
ArrayIsArray,
54
ArrayPrototypeForEach,
65
ArrayPrototypeMap,
76
ArrayPrototypePush,
@@ -122,11 +121,9 @@ class Worker extends EventEmitter {
122121
constructor(filename, options = {}) {
123122
super();
124123
debug(`[${threadId}] create new worker`, filename, options);
125-
if (options.execArgv && !ArrayIsArray(options.execArgv)) {
126-
throw new ERR_INVALID_ARG_TYPE('options.execArgv',
127-
'Array',
128-
options.execArgv);
129-
}
124+
if (options.execArgv)
125+
validateArray(options.execArgv, 'options.execArgv');
126+
130127
let argv;
131128
if (options.argv) {
132129
validateArray(options.argv, 'options.argv');

0 commit comments

Comments
 (0)