Skip to content
Permalink
Browse files

buffer: change var to let

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 Nov 6, 2019
1 parent 2938fe3 commit 58fca405c1d9f8791fc3cbe0b71d62f0824cbd18
Showing with 6 additions and 6 deletions.
  1. +6 −6 lib/buffer.js
@@ -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;
};
@@ -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;
}
@@ -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 };
}
@@ -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;
}
@@ -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);
}
@@ -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);

0 comments on commit 58fca40

Please sign in to comment.
You can’t perform that action at this time.