diff --git a/lib/fs.js b/lib/fs.js index 56421924fd287a..8d2c1dca628a2b 100644 --- a/lib/fs.js +++ b/lib/fs.js @@ -408,7 +408,7 @@ function open(path, flags, mode, callback) { path = toPathIfFileURL(path); validatePath(path); const flagsNumber = stringToFlags(flags); - if (arguments.length < 4) { + if (typeof mode === 'function') { callback = makeCallback(mode); mode = 0o666; } else { @@ -788,7 +788,7 @@ function readdirSync(path, options) { } function fstat(fd, options, callback) { - if (arguments.length < 3) { + if (typeof options === 'function') { callback = options; options = {}; } @@ -799,7 +799,7 @@ function fstat(fd, options, callback) { } function lstat(path, options, callback) { - if (arguments.length < 3) { + if (typeof options === 'function') { callback = options; options = {}; } @@ -812,7 +812,7 @@ function lstat(path, options, callback) { } function stat(path, options, callback) { - if (arguments.length < 3) { + if (typeof options === 'function') { callback = options; options = {}; }