mirror of https://github.com/nodejs/node.git
src: prefer param function check over args length
PR-URL: https://github.com/nodejs/node/pull/23835 Reviewed-By: Refael Ackermann <refack@gmail.com> Reviewed-By: Matheus Marchini <mat@mmarchini.me> Reviewed-By: Colin Ihrig <cjihrig@gmail.com> Reviewed-By: Anna Henningsen <anna@addaleax.net> Reviewed-By: Michael Dawson <michael_dawson@ca.ibm.com> Reviewed-By: James M Snell <jasnell@gmail.com> Reviewed-By: John-David Dalton <john.david.dalton@gmail.com> Reviewed-By: Yuta Hiroto <hello@hiroppy.me>pull/24124/head
parent
d8e06b23b0
commit
7cf56797dd
|
@ -418,7 +418,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;
|
||||
}
|
||||
|
@ -811,7 +811,7 @@ function readdirSync(path, options) {
|
|||
}
|
||||
|
||||
function fstat(fd, options, callback) {
|
||||
if (arguments.length < 3) {
|
||||
if (typeof options === 'function') {
|
||||
callback = options;
|
||||
options = {};
|
||||
}
|
||||
|
@ -822,7 +822,7 @@ function fstat(fd, options, callback) {
|
|||
}
|
||||
|
||||
function lstat(path, options, callback) {
|
||||
if (arguments.length < 3) {
|
||||
if (typeof options === 'function') {
|
||||
callback = options;
|
||||
options = {};
|
||||
}
|
||||
|
@ -835,7 +835,7 @@ function lstat(path, options, callback) {
|
|||
}
|
||||
|
||||
function stat(path, options, callback) {
|
||||
if (arguments.length < 3) {
|
||||
if (typeof options === 'function') {
|
||||
callback = options;
|
||||
options = {};
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue