From 547fc863715c491e66cb962eedda94b9b7e241b3 Mon Sep 17 00:00:00 2001 From: Voltrex Date: Sun, 15 Aug 2021 23:34:48 +0430 Subject: [PATCH] lib: use `validateArray` MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 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 Reviewed-By: Tobias Nießen Reviewed-By: Luigi Pinca Reviewed-By: Zijian Liu Reviewed-By: Khaidi Chu Reviewed-By: Qingyu Deng --- lib/internal/worker.js | 9 +++------ 1 file changed, 3 insertions(+), 6 deletions(-) diff --git a/lib/internal/worker.js b/lib/internal/worker.js index d59399bfefed10..1d2cd8cefd2996 100644 --- a/lib/internal/worker.js +++ b/lib/internal/worker.js @@ -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');