From 53eefeb73eb07498fa1bdc3e7e76087db59012c7 Mon Sep 17 00:00:00 2001 From: Rich Trott Date: Sun, 28 Apr 2019 00:06:23 -0700 Subject: [PATCH] buffer: remove unreachable code MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Remove unreachable code from lib/buffer.js. PR-URL: https://github.com/nodejs/node/pull/27445 Reviewed-By: Michaƫl Zasso Reviewed-By: Yongsheng Zhang Reviewed-By: Ruben Bridgewater Reviewed-By: Colin Ihrig Reviewed-By: Luigi Pinca Reviewed-By: Anna Henningsen --- lib/buffer.js | 6 +----- 1 file changed, 1 insertion(+), 5 deletions(-) diff --git a/lib/buffer.js b/lib/buffer.js index 1fac94d568ffae..8c16f07acebc5b 100644 --- a/lib/buffer.js +++ b/lib/buffer.js @@ -894,11 +894,7 @@ Buffer.prototype.write = function write(string, offset, length, encoding) { // Buffer#write(string, offset[, length][, encoding]) } else { - if (offset === undefined) { - offset = 0; - } else { - validateInt32(offset, 'offset', 0, this.length); - } + validateInt32(offset, 'offset', 0, this.length); const remaining = this.length - offset;