From 05886cbab1d737936699c442cb30d89a165ca467 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Micha=C3=ABl=20Zasso?= Date: Thu, 15 Sep 2016 20:28:02 +0200 Subject: [PATCH] buffer: remove unnecessary argument check MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 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 Reviewed-By: Сковорода Никита Андреевич --- lib/buffer.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/buffer.js b/lib/buffer.js index f43ec7acd86..876bdbe1cfd 100644 --- a/lib/buffer.js +++ b/lib/buffer.js @@ -539,7 +539,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)