summaryrefslogtreecommitdiff
path: root/lib/child_process.js
diff options
context:
space:
mode:
authorJon Moss <me@jonathanmoss.me>2018-08-02 18:51:02 -0400
committerJon Moss <me@jonathanmoss.me>2018-08-07 10:51:27 -0400
commite570ae79f5b1d74fed52d2aed7f014caaa0836dd (patch)
tree004749b9ff1a59964ba7186c105956614671e48a /lib/child_process.js
parent080316b32a0e6320e012214c32725099a0248de6 (diff)
downloadandroid-node-v8-e570ae79f5b1d74fed52d2aed7f014caaa0836dd.tar.gz
android-node-v8-e570ae79f5b1d74fed52d2aed7f014caaa0836dd.tar.bz2
android-node-v8-e570ae79f5b1d74fed52d2aed7f014caaa0836dd.zip
lib: extract validateString validator
Pulls out a common argument validator to `internal/validators` PR-URL: https://github.com/nodejs/node/pull/22101 Reviewed-By: Joyee Cheung <joyeec9h3@gmail.com> Reviewed-By: Michaƫl Zasso <targos@protonmail.com> Reviewed-By: Trivikram Kamat <trivikr.dev@gmail.com> Reviewed-By: Colin Ihrig <cjihrig@gmail.com> Reviewed-By: Anatoli Papirovski <apapirovski@mac.com> Reviewed-By: Luigi Pinca <luigipinca@gmail.com> Reviewed-By: James M Snell <jasnell@gmail.com>
Diffstat (limited to 'lib/child_process.js')
-rw-r--r--lib/child_process.js4
1 files changed, 2 insertions, 2 deletions
diff --git a/lib/child_process.js b/lib/child_process.js
index a790e85ee2..8460a732d9 100644
--- a/lib/child_process.js
+++ b/lib/child_process.js
@@ -37,6 +37,7 @@ const {
ERR_INVALID_OPT_VALUE,
ERR_OUT_OF_RANGE
} = require('internal/errors').codes;
+const { validateString } = require('internal/validators');
const child_process = require('internal/child_process');
const {
_validateStdio,
@@ -390,8 +391,7 @@ function _convertCustomFds(options) {
}
function normalizeSpawnArguments(file, args, options) {
- if (typeof file !== 'string')
- throw new ERR_INVALID_ARG_TYPE('file', 'string', file);
+ validateString(file, 'file');
if (file.length === 0)
throw new ERR_INVALID_ARG_VALUE('file', file, 'cannot be empty');