mirror of
https://github.com/zebrajr/node.git
synced 2026-01-15 12:15:26 +00:00
lib: use validateArray
The `validateArray()` validator could be used to cleanup validation and keep consistency. PR-URL: https://github.com/nodejs/node/pull/39774 Reviewed-By: James M Snell <jasnell@gmail.com> Reviewed-By: Tobias Nießen <tniessen@tnie.de> Reviewed-By: Luigi Pinca <luigipinca@gmail.com> Reviewed-By: Zijian Liu <lxxyxzj@gmail.com> Reviewed-By: Khaidi Chu <i@2333.moe> Reviewed-By: Qingyu Deng <i@ayase-lab.com>
This commit is contained in:
committed by
Node.js GitHub Bot
parent
b25a73f26a
commit
256fe21045
@@ -1,7 +1,6 @@
|
||||
'use strict';
|
||||
|
||||
const {
|
||||
ArrayIsArray,
|
||||
ArrayPrototypeForEach,
|
||||
ArrayPrototypeMap,
|
||||
ArrayPrototypePush,
|
||||
@@ -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');
|
||||
|
||||
Reference in New Issue
Block a user