Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

src: prefer param function check over args length #23835

Closed
wants to merge 1 commit into from
Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
src: prefer param function check over args length
  • Loading branch information
codebytere committed Nov 6, 2018
commit 4f86c6e2fc8ac723c3f23607a0eb62e45115e8c8
8 changes: 4 additions & 4 deletions lib/fs.js
Original file line number Diff line number Diff line change
Expand Up @@ -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;
}
Expand Down Expand Up @@ -808,7 +808,7 @@ function readdirSync(path, options) {
}

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