Skip to content

Commit 3fcdf4e

Browse files
targosFishrock123
authored andcommitted
buffer: remove unnecessary argument check
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>
1 parent e16f95d commit 3fcdf4e

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

lib/buffer.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -529,7 +529,7 @@ Buffer.prototype.compare = function compare(target,
529529
if (start === undefined)
530530
start = 0;
531531
if (end === undefined)
532-
end = target ? target.length : 0;
532+
end = target.length;
533533
if (thisStart === undefined)
534534
thisStart = 0;
535535
if (thisEnd === undefined)

0 commit comments

Comments
 (0)