Skip to content

Commit 152888c

Browse files
JonasBaehsankhfr
authored andcommitted
fs: remove unnecessary option argument validation
PR-URL: nodejs#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 5358086 commit 152888c

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
@@ -1350,19 +1350,20 @@ function mkdirSync(path, options) {
13501350
let mode = 0o777;
13511351
let recursive = false;
13521352
if (typeof options === 'number' || typeof options === 'string') {
1353-
mode = options;
1353+
mode = parseFileMode(options, 'mode');
13541354
} else if (options) {
1355-
if (options.recursive !== undefined)
1355+
if (options.recursive !== undefined) {
13561356
recursive = options.recursive;
1357-
if (options.mode !== undefined)
1358-
mode = options.mode;
1357+
validateBoolean(recursive, 'options.recursive');
1358+
}
1359+
if (options.mode !== undefined) {
1360+
mode = parseFileMode(options.mode, 'options.mode');
1361+
}
13591362
}
1360-
path = getValidatedPath(path);
1361-
validateBoolean(recursive, 'options.recursive');
13621363

13631364
const result = binding.mkdir(
1364-
path,
1365-
parseFileMode(mode, 'mode'),
1365+
getValidatedPath(path),
1366+
mode,
13661367
recursive,
13671368
);
13681369

0 commit comments

Comments
 (0)