Skip to content

Commit

Permalink
src: prefer param function check over args length
Browse files Browse the repository at this point in the history
PR-URL: #23835
Reviewed-By: Refael Ackermann <[email protected]>
Reviewed-By: Matheus Marchini <[email protected]>
Reviewed-By: Colin Ihrig <[email protected]>
Reviewed-By: Anna Henningsen <[email protected]>
Reviewed-By: Michael Dawson <[email protected]>
Reviewed-By: James M Snell <[email protected]>
Reviewed-By: John-David Dalton <[email protected]>
Reviewed-By: Yuta Hiroto <[email protected]>
  • Loading branch information
codebytere authored and MylesBorins committed Dec 3, 2018
1 parent 5ed5f03 commit 9106ccf
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions lib/fs.js
Original file line number Diff line number Diff line change
Expand Up @@ -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 {
Expand Down Expand Up @@ -788,7 +788,7 @@ function readdirSync(path, options) {
}

function fstat(fd, options, callback) {
if (arguments.length < 3) {
if (typeof options === 'function') {
callback = options;
options = {};
}
Expand All @@ -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 = {};
}
Expand All @@ -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 = {};
}
Expand Down

0 comments on commit 9106ccf

Please sign in to comment.