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 <[email protected]>
Reviewed-By: Colin Ihrig <[email protected]>
Reviewed-By: James M Snell <[email protected]>
Reviewed-By: Luigi Pinca <[email protected]>
Reviewed-By: Juan José Arboleda <[email protected]>
Reviewed-By: Ruben Bridgewater <[email protected]>
  • Loading branch information
seishun authored and BridgeAR committed May 23, 2020
1 parent 539c56e commit 9cd83c7
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 9cd83c7

Please sign in to comment.