Skip to content

Commit 8086337

Browse files
JonasBatargos
authored andcommitted
fs: remove unnecessary option argument validation
PR-URL: #53861 Reviewed-By: Yagiz Nizipli <[email protected]> Reviewed-By: James M Snell <[email protected]> Reviewed-By: Vinícius Lourenço Claro Cardoso <[email protected]>
1 parent 1688f00 commit 8086337

File tree

1 file changed

+9
-8
lines changed

1 file changed

+9
-8
lines changed

lib/fs.js

+9-8
Original file line numberDiff line numberDiff line change
@@ -1349,19 +1349,20 @@ function mkdirSync(path, options) {
13491349
let mode = 0o777;
13501350
let recursive = false;
13511351
if (typeof options === 'number' || typeof options === 'string') {
1352-
mode = options;
1352+
mode = parseFileMode(options, 'mode');
13531353
} else if (options) {
1354-
if (options.recursive !== undefined)
1354+
if (options.recursive !== undefined) {
13551355
recursive = options.recursive;
1356-
if (options.mode !== undefined)
1357-
mode = options.mode;
1356+
validateBoolean(recursive, 'options.recursive');
1357+
}
1358+
if (options.mode !== undefined) {
1359+
mode = parseFileMode(options.mode, 'options.mode');
1360+
}
13581361
}
1359-
path = getValidatedPath(path);
1360-
validateBoolean(recursive, 'options.recursive');
13611362

13621363
const result = binding.mkdir(
1363-
path,
1364-
parseFileMode(mode, 'mode'),
1364+
getValidatedPath(path),
1365+
mode,
13651366
recursive,
13661367
);
13671368

0 commit comments

Comments
 (0)