diff --git a/lib/fs.js b/lib/fs.js index 89c005375f450e..16ce9450ea02ca 100644 --- a/lib/fs.js +++ b/lib/fs.js @@ -415,7 +415,7 @@ function open(path, flags, mode, callback) { callback = flags; flags = 'r'; mode = 0o666; - } else if (arguments.length === 3) { + } else if (typeof mode === 'function') { callback = mode; mode = 0o666; } @@ -808,7 +808,7 @@ function readdirSync(path, options) { } function fstat(fd, options, callback) { - if (arguments.length < 3) { + if (typeof options === 'function') { callback = options; options = {}; } @@ -819,7 +819,7 @@ function fstat(fd, options, callback) { } function lstat(path, options, callback) { - if (arguments.length < 3) { + if (typeof options === 'function') { callback = options; options = {}; } @@ -832,7 +832,7 @@ function lstat(path, options, callback) { } function stat(path, options, callback) { - if (arguments.length < 3) { + if (typeof options === 'function') { callback = options; options = {}; }