From 112228c15abd561b24858af1a845aadcae8f9a74 Mon Sep 17 00:00:00 2001 From: Jonas Date: Tue, 6 Aug 2024 14:43:41 -0400 Subject: [PATCH] fs: remove unnecessary option argument validation PR-URL: https://github.com/nodejs/node/pull/53958 Reviewed-By: Yagiz Nizipli --- lib/fs.js | 18 +++++++++--------- 1 file changed, 9 insertions(+), 9 deletions(-) diff --git a/lib/fs.js b/lib/fs.js index 44d8ded94e8e43..1497c0935a130c 100644 --- a/lib/fs.js +++ b/lib/fs.js @@ -1314,23 +1314,23 @@ function mkdir(path, options, callback) { if (typeof options === 'function') { callback = options; } else if (typeof options === 'number' || typeof options === 'string') { - mode = options; + mode = parseFileMode(options, 'mode'); } else if (options) { - if (options.recursive !== undefined) + if (options.recursive !== undefined) { recursive = options.recursive; - if (options.mode !== undefined) - mode = options.mode; + validateBoolean(recursive, 'options.recursive'); + } + if (options.mode !== undefined) { + mode = parseFileMode(options.mode, 'options.mode'); + } } callback = makeCallback(callback); - path = getValidatedPath(path); - - validateBoolean(recursive, 'options.recursive'); const req = new FSReqCallback(); req.oncomplete = callback; binding.mkdir( - path, - parseFileMode(mode, 'mode'), + getValidatedPath(path), + mode, recursive, req, );