Skip to content

Commit 112228c

Browse files
JonasBatargos
authored andcommitted
fs: remove unnecessary option argument validation
PR-URL: #53958 Reviewed-By: Yagiz Nizipli <yagiz@nizipli.com>
1 parent 783322f commit 112228c

File tree

1 file changed

+9
-9
lines changed

1 file changed

+9
-9
lines changed

Diff for: lib/fs.js

+9-9
Original file line numberDiff line numberDiff line change
@@ -1314,23 +1314,23 @@ function mkdir(path, options, callback) {
13141314
if (typeof options === 'function') {
13151315
callback = options;
13161316
} else if (typeof options === 'number' || typeof options === 'string') {
1317-
mode = options;
1317+
mode = parseFileMode(options, 'mode');
13181318
} else if (options) {
1319-
if (options.recursive !== undefined)
1319+
if (options.recursive !== undefined) {
13201320
recursive = options.recursive;
1321-
if (options.mode !== undefined)
1322-
mode = options.mode;
1321+
validateBoolean(recursive, 'options.recursive');
1322+
}
1323+
if (options.mode !== undefined) {
1324+
mode = parseFileMode(options.mode, 'options.mode');
1325+
}
13231326
}
13241327
callback = makeCallback(callback);
1325-
path = getValidatedPath(path);
1326-
1327-
validateBoolean(recursive, 'options.recursive');
13281328

13291329
const req = new FSReqCallback();
13301330
req.oncomplete = callback;
13311331
binding.mkdir(
1332-
path,
1333-
parseFileMode(mode, 'mode'),
1332+
getValidatedPath(path),
1333+
mode,
13341334
recursive,
13351335
req,
13361336
);

0 commit comments

Comments
 (0)