fs: remove unnecessary option argument validation

PR-URL: https://github.com/nodejs/node/pull/53861
Reviewed-By: Yagiz Nizipli <yagiz@nizipli.com>
Reviewed-By: James M Snell <jasnell@gmail.com>
Reviewed-By: Vinícius Lourenço Claro Cardoso <contact@viniciusl.com.br>
This commit is contained in:
Jonas 2024-07-17 19:29:56 -04:00 committed by GitHub
parent 5c491cf5fb
commit bcec922e3e
No known key found for this signature in database
GPG key ID: B5690EEEBB952194

View file

@ -1350,19 +1350,20 @@ function mkdirSync(path, options) {
let mode = 0o777;
let recursive = false;
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');
}
}
path = getValidatedPath(path);
validateBoolean(recursive, 'options.recursive');
const result = binding.mkdir(
path,
parseFileMode(mode, 'mode'),
getValidatedPath(path),
mode,
recursive,
);