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: https://github.com/nodejs/node/pull/8552
Reviewed-By: Rich Trott <rtrott@gmail.com>
Reviewed-By: Сковорода Никита Андреевич <chalkerx@gmail.com>
This commit is contained in:
Michaël Zasso authored and Jeremiah Senkpiel committed 2016-10-11 12:26:38 -04:00
1 parent e16f95db4d
commit 3fcdf4e80a
1 file changed
+1 -1
+1 -1
View File
@@ -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)