buffer: remove hoisted variable

PR-URL: https://github.com/nodejs/node/pull/33470
Reviewed-By: Anna Henningsen <anna@addaleax.net>
Reviewed-By: Colin Ihrig <cjihrig@gmail.com>
Reviewed-By: James M Snell <jasnell@gmail.com>
Reviewed-By: Luigi Pinca <luigipinca@gmail.com>
Reviewed-By: Juan José Arboleda <soyjuanarbol@gmail.com>
Reviewed-By: Ruben Bridgewater <ruben@bridgewater.de>
pull/33529/head
Nikolai Vavilov 2020-05-19 17:51:55 +03:00 committed by Ruben Bridgewater
parent 539c56ed2c
commit 9cd83c761f
1 changed files with 2 additions and 3 deletions

View File

@ -544,7 +544,6 @@ Buffer.isEncoding = function isEncoding(encoding) {
Buffer[kIsEncodingSymbol] = Buffer.isEncoding;
Buffer.concat = function concat(list, length) {
let i;
if (!ArrayIsArray(list)) {
throw new ERR_INVALID_ARG_TYPE('list', 'Array', list);
}
@ -554,7 +553,7 @@ Buffer.concat = function concat(list, length) {
if (length === undefined) {
length = 0;
for (i = 0; i < list.length; i++) {
for (let i = 0; i < list.length; i++) {
if (list[i].length) {
length += list[i].length;
}
@ -565,7 +564,7 @@ Buffer.concat = function concat(list, length) {
const buffer = Buffer.allocUnsafe(length);
let pos = 0;
for (i = 0; i < list.length; i++) {
for (let i = 0; i < list.length; i++) {
const buf = list[i];
if (!isUint8Array(buf)) {
// TODO(BridgeAR): This should not be of type ERR_INVALID_ARG_TYPE.