Skip to content

Commit

Permalink
fs: remove unnecessary option argument validation
Browse files Browse the repository at this point in the history
PR-URL: #53958
Reviewed-By: Yagiz Nizipli <yagiz@nizipli.com>
  • Loading branch information
JonasBa authored and targos committed Aug 14, 2024
1 parent 783322f commit 112228c
Showing 1 changed file with 9 additions and 9 deletions.
18 changes: 9 additions & 9 deletions lib/fs.js
Original file line number Diff line number Diff line change
Expand Up @@ -1314,23 +1314,23 @@ function mkdir(path, options, callback) {
if (typeof options === 'function') {
callback = options;
} else 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');
}
}
callback = makeCallback(callback);
path = getValidatedPath(path);

validateBoolean(recursive, 'options.recursive');

const req = new FSReqCallback();
req.oncomplete = callback;
binding.mkdir(
path,
parseFileMode(mode, 'mode'),
getValidatedPath(path),
mode,
recursive,
req,
);
Expand Down

0 comments on commit 112228c

Please sign in to comment.