Skip to content

Commit

Permalink
buffer: remove unnecessary argument check
Browse files Browse the repository at this point in the history
In Buffer.prototype.compare, the first check makes sure that target is
an instance of Buffer. The value cannot be falsy after that so we can
safely get its length.

PR-URL: #8552
Reviewed-By: Rich Trott <rtrott@gmail.com>
Reviewed-By: Сковорода Никита Андреевич <chalkerx@gmail.com>
  • Loading branch information
targos authored and Fishrock123 committed Oct 11, 2016
1 parent e16f95d commit 3fcdf4e
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion lib/buffer.js
Original file line number Diff line number Diff line change
Expand Up @@ -529,7 +529,7 @@ Buffer.prototype.compare = function compare(target,
if (start === undefined)
start = 0;
if (end === undefined)
end = target ? target.length : 0;
end = target.length;
if (thisStart === undefined)
thisStart = 0;
if (thisEnd === undefined)
Expand Down

0 comments on commit 3fcdf4e

Please sign in to comment.