Skip to content

Commit

Permalink
buffer: remove hoisted variable
Browse files Browse the repository at this point in the history
PR-URL: #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>
  • Loading branch information
seishun authored and codebytere committed Jul 8, 2020
1 parent f495ab3 commit 5a6d80f
Showing 1 changed file with 2 additions and 3 deletions.
5 changes: 2 additions & 3 deletions lib/buffer.js
Original file line number Diff line number Diff line change
Expand Up @@ -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);
}
Expand All @@ -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;
}
Expand All @@ -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.
Expand Down

0 comments on commit 5a6d80f

Please sign in to comment.