Skip to content

Commit

Permalink
fs: remove unnecessary option argument validation
Browse files Browse the repository at this point in the history
PR-URL: #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 and targos committed Jul 28, 2024
1 parent 1688f00 commit 8086337
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 @@ -1349,19 +1349,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 8086337

Please sign in to comment.