Skip to content

Commit 1096e16

Browse files
committed
lib: use validator
Used the `validateArray()` validator for validation of an array for consistency.
1 parent 5ad6a99 commit 1096e16

File tree

1 file changed

+4
-6
lines changed

1 file changed

+4
-6
lines changed

lib/internal/child_process.js

Lines changed: 4 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -366,11 +366,8 @@ ChildProcess.prototype.spawn = function(options) {
366366
// Let child process know about opened IPC channel
367367
if (options.envPairs === undefined)
368368
options.envPairs = [];
369-
else if (!ArrayIsArray(options.envPairs)) {
370-
throw new ERR_INVALID_ARG_TYPE('options.envPairs',
371-
'Array',
372-
options.envPairs);
373-
}
369+
else
370+
validateArray(options.envPairs, 'options.envPairs');
374371

375372
ArrayPrototypePush(options.envPairs, `NODE_CHANNEL_FD=${ipcFd}`);
376373
ArrayPrototypePush(options.envPairs,
@@ -652,7 +649,8 @@ function setupChannel(target, channel, serializationMode) {
652649
}
653650
}
654651

655-
assert(ArrayIsArray(target._handleQueue));
652+
validateArray(target._handleQueue, 'target._handleQueue');
653+
656654
const queue = target._handleQueue;
657655
target._handleQueue = null;
658656

0 commit comments

Comments
 (0)