Skip to content

Commit

Permalink
buffer: change var to let
Browse files Browse the repository at this point in the history
PR-URL: #30292
Reviewed-By: Сковорода Никита Андреевич <chalkerx@gmail.com>
Reviewed-By: Anna Henningsen <anna@addaleax.net>
Reviewed-By: Jiawen Geng <technicalcute@gmail.com>
Reviewed-By: Colin Ihrig <cjihrig@gmail.com>
Reviewed-By: Trivikram Kamat <trivikr.dev@gmail.com>
Reviewed-By: Ruben Bridgewater <ruben@bridgewater.de>
Reviewed-By: Gireesh Punathil <gpunathi@in.ibm.com>
  • Loading branch information
darky authored and MylesBorins committed Dec 17, 2019
1 parent 2938fe3 commit 58fca40
Showing 1 changed file with 6 additions and 6 deletions.
12 changes: 6 additions & 6 deletions lib/buffer.js
Original file line number Diff line number Diff line change
Expand Up @@ -317,7 +317,7 @@ Buffer.from = function from(value, encodingOrOffset, length) {
// Refs: https://esdiscuss.org/topic/isconstructor#content-11
const of = (...items) => {
const newObj = createUnsafeBuffer(items.length);
for (var k = 0; k < items.length; k++)
for (let k = 0; k < items.length; k++)
newObj[k] = items[k];
return newObj;
};
Expand Down Expand Up @@ -433,7 +433,7 @@ function fromString(string, encoding) {
function fromArrayLike(obj) {
const length = obj.length;
const b = allocate(length);
for (var i = 0; i < length; i++)
for (let i = 0; i < length; i++)
b[i] = obj[i];
return b;
}
Expand Down Expand Up @@ -1044,7 +1044,7 @@ Buffer.prototype.write = function write(string, offset, length, encoding) {
Buffer.prototype.toJSON = function toJSON() {
if (this.length > 0) {
const data = new Array(this.length);
for (var i = 0; i < this.length; ++i)
for (let i = 0; i < this.length; ++i)
data[i] = this[i];
return { type: 'Buffer', data };
}
Expand Down Expand Up @@ -1090,7 +1090,7 @@ Buffer.prototype.swap16 = function swap16() {
if (len % 2 !== 0)
throw new ERR_INVALID_BUFFER_SIZE('16-bits');
if (len < 128) {
for (var i = 0; i < len; i += 2)
for (let i = 0; i < len; i += 2)
swap(this, i, i + 1);
return this;
}
Expand All @@ -1105,7 +1105,7 @@ Buffer.prototype.swap32 = function swap32() {
if (len % 4 !== 0)
throw new ERR_INVALID_BUFFER_SIZE('32-bits');
if (len < 192) {
for (var i = 0; i < len; i += 4) {
for (let i = 0; i < len; i += 4) {
swap(this, i, i + 3);
swap(this, i + 1, i + 2);
}
Expand All @@ -1122,7 +1122,7 @@ Buffer.prototype.swap64 = function swap64() {
if (len % 8 !== 0)
throw new ERR_INVALID_BUFFER_SIZE('64-bits');
if (len < 192) {
for (var i = 0; i < len; i += 8) {
for (let i = 0; i < len; i += 8) {
swap(this, i, i + 7);
swap(this, i + 1, i + 6);
swap(this, i + 2, i + 5);
Expand Down

0 comments on commit 58fca40

Please sign in to comment.