Skip to content

Commit

Permalink
fs: remove unnecessary option argument validation
Browse files Browse the repository at this point in the history
PR-URL: nodejs#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>
  • Loading branch information
JonasBa authored Jul 17, 2024
1 parent 5c491cf commit bcec922
Showing 1 changed file with 9 additions and 8 deletions.
17 changes: 9 additions & 8 deletions lib/fs.js
Original file line number Diff line number Diff line change
Expand Up @@ -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,
);

Expand Down

0 comments on commit bcec922

Please sign in to comment.