Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
fs: remove unnecessary option argument validation
  • Loading branch information
JonasBa committed Jul 15, 2024
commit ce7a3c296ae4b7fdb4ac52d0481e77664d07afb0
17 changes: 9 additions & 8 deletions lib/fs.js
Original file line number Diff line number Diff line change
Expand Up @@ -1351,19 +1351,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