Skip to content

Commit

Permalink
lib: use validator
Browse files Browse the repository at this point in the history
Used the `validateArray()` validator for validation of an array for consistency.
  • Loading branch information
VoltrexKeyva committed Jul 27, 2021
1 parent 5ad6a99 commit 1096e16
Showing 1 changed file with 4 additions and 6 deletions.
10 changes: 4 additions & 6 deletions lib/internal/child_process.js
Original file line number Diff line number Diff line change
Expand Up @@ -366,11 +366,8 @@ ChildProcess.prototype.spawn = function(options) {
// Let child process know about opened IPC channel
if (options.envPairs === undefined)
options.envPairs = [];
else if (!ArrayIsArray(options.envPairs)) {
throw new ERR_INVALID_ARG_TYPE('options.envPairs',
'Array',
options.envPairs);
}
else
validateArray(options.envPairs, 'options.envPairs');

ArrayPrototypePush(options.envPairs, `NODE_CHANNEL_FD=${ipcFd}`);
ArrayPrototypePush(options.envPairs,
Expand Down Expand Up @@ -652,7 +649,8 @@ function setupChannel(target, channel, serializationMode) {
}
}

assert(ArrayIsArray(target._handleQueue));
validateArray(target._handleQueue, 'target._handleQueue');

const queue = target._handleQueue;
target._handleQueue = null;

Expand Down

0 comments on commit 1096e16

Please sign in to comment.