mirror of
https://github.com/nodejs/node.git
synced 2025-08-15 13:48:44 +02:00
fs: remove unnecessary option argument validation
PR-URL: https://github.com/nodejs/node/pull/53861 Reviewed-By: Yagiz Nizipli <yagiz@nizipli.com> Reviewed-By: James M Snell <jasnell@gmail.com> Reviewed-By: Vinícius Lourenço Claro Cardoso <contact@viniciusl.com.br>
This commit is contained in:
parent
5c491cf5fb
commit
bcec922e3e
1 changed files with 9 additions and 8 deletions
17
lib/fs.js
17
lib/fs.js
|
@ -1350,19 +1350,20 @@ function mkdirSync(path, options) {
|
||||||
let mode = 0o777;
|
let mode = 0o777;
|
||||||
let recursive = false;
|
let recursive = false;
|
||||||
if (typeof options === 'number' || typeof options === 'string') {
|
if (typeof options === 'number' || typeof options === 'string') {
|
||||||
mode = options;
|
mode = parseFileMode(options, 'mode');
|
||||||
} else if (options) {
|
} else if (options) {
|
||||||
if (options.recursive !== undefined)
|
if (options.recursive !== undefined) {
|
||||||
recursive = options.recursive;
|
recursive = options.recursive;
|
||||||
if (options.mode !== undefined)
|
validateBoolean(recursive, 'options.recursive');
|
||||||
mode = options.mode;
|
}
|
||||||
|
if (options.mode !== undefined) {
|
||||||
|
mode = parseFileMode(options.mode, 'options.mode');
|
||||||
|
}
|
||||||
}
|
}
|
||||||
path = getValidatedPath(path);
|
|
||||||
validateBoolean(recursive, 'options.recursive');
|
|
||||||
|
|
||||||
const result = binding.mkdir(
|
const result = binding.mkdir(
|
||||||
path,
|
getValidatedPath(path),
|
||||||
parseFileMode(mode, 'mode'),
|
mode,
|
||||||
recursive,
|
recursive,
|
||||||
);
|
);
|
||||||
|
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue