From 4f86c6e2fc8ac723c3f23607a0eb62e45115e8c8 Mon Sep 17 00:00:00 2001 From: Shelley Vohr Date: Tue, 6 Nov 2018 11:17:26 -0800 Subject: [PATCH] src: prefer param function check over args length --- lib/fs.js | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) 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 = {}; }