Skip to content

Commit

Permalink
fix: use optional chaining instead of validateBuffer
Browse files Browse the repository at this point in the history
  • Loading branch information
wafuwafu13 committed Sep 25, 2022
1 parent 9c62ea8 commit 888beff
Showing 1 changed file with 1 addition and 2 deletions.
3 changes: 1 addition & 2 deletions lib/fs.js
Expand Up @@ -619,7 +619,6 @@ function read(fd, buffer, offsetOrOptions, length, position, callback) {
// This is fs.read(fd, params, callback)
params = buffer;
({ buffer = Buffer.alloc(16384) } = params ?? kEmptyObject);
validateBuffer(buffer);
}
callback = offsetOrOptions;
} else {
Expand All @@ -633,7 +632,7 @@ function read(fd, buffer, offsetOrOptions, length, position, callback) {
}
({
offset = 0,
length = buffer.byteLength - offset,
length = buffer?.byteLength - offset,
position = null,
} = params ?? kEmptyObject);
}
Expand Down

0 comments on commit 888beff

Please sign in to comment.