mirror of
https://github.com/nodejs/node.git
synced 2026-10-14 10:26:26 -04:00
buffer: change var to let
PR-URL: https://github.com/nodejs/node/pull/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>
This commit is contained in:
1 parent
8bb83f4d3d
commit
615ec972de
1 file changed
+6
-6
+6
-6
@@ -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);
|
||||
|
||||
Reference in new issue
Block a user