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 mode = 0o777;
let recursive = false; let recursive = false;
if (typeof options === 'number' || typeof options === 'string') { if (typeof options === 'number' || typeof options === 'string') {
mode = options; mode = parseFileMode(options, 'mode');
} else if (options) { } else if (options) {
if (options.recursive !== undefined) if (options.recursive !== undefined) {
recursive = options.recursive; recursive = options.recursive;
if (options.mode !== undefined) validateBoolean(recursive, 'options.recursive');
mode = options.mode; }
if (options.mode !== undefined) {
mode = parseFileMode(options.mode, 'options.mode');
}
} }
path = getValidatedPath(path);
validateBoolean(recursive, 'options.recursive');
const result = binding.mkdir( const result = binding.mkdir(
path, getValidatedPath(path),
parseFileMode(mode, 'mode'), mode,
recursive, recursive,
); );