Skip to content

Commit a4c404c

Browse files
lmamminotargos
authored andcommitted
util: use let instead of var for util/inspect.js
PR-URL: #30399 Reviewed-By: James M Snell <[email protected]> Reviewed-By: Colin Ihrig <[email protected]> Reviewed-By: Gireesh Punathil <[email protected]> Reviewed-By: Ruben Bridgewater <[email protected]> Reviewed-By: Trivikram Kamat <[email protected]>
1 parent 2c29db1 commit a4c404c

File tree

1 file changed

+5
-5
lines changed

1 file changed

+5
-5
lines changed

lib/internal/util/inspect.js

+5-5
Original file line numberDiff line numberDiff line change
@@ -1133,7 +1133,7 @@ function formatPrimitive(fn, value, ctx) {
11331133

11341134
function formatNamespaceObject(ctx, value, recurseTimes, keys) {
11351135
const output = new Array(keys.length);
1136-
for (var i = 0; i < keys.length; i++) {
1136+
for (let i = 0; i < keys.length; i++) {
11371137
try {
11381138
output[i] = formatProperty(ctx, value, recurseTimes, keys[i],
11391139
kObjectType);
@@ -1221,7 +1221,7 @@ function formatArray(ctx, value, recurseTimes) {
12211221

12221222
const remaining = valLen - len;
12231223
const output = [];
1224-
for (var i = 0; i < len; i++) {
1224+
for (let i = 0; i < len; i++) {
12251225
// Special handle sparse arrays.
12261226
if (!hasOwnProperty(value, i)) {
12271227
return formatSpecialArray(ctx, value, recurseTimes, len, output, i);
@@ -1297,7 +1297,7 @@ function formatSetIterInner(ctx, recurseTimes, entries, state) {
12971297
const maxLength = Math.min(maxArrayLength, entries.length);
12981298
let output = new Array(maxLength);
12991299
ctx.indentationLvl += 2;
1300-
for (var i = 0; i < maxLength; i++) {
1300+
for (let i = 0; i < maxLength; i++) {
13011301
output[i] = formatValue(ctx, entries[i], recurseTimes);
13021302
}
13031303
ctx.indentationLvl -= 2;
@@ -1465,7 +1465,7 @@ function isBelowBreakLength(ctx, output, start, base) {
14651465
let totalLength = output.length + start;
14661466
if (totalLength + output.length > ctx.breakLength)
14671467
return false;
1468-
for (var i = 0; i < output.length; i++) {
1468+
for (let i = 0; i < output.length; i++) {
14691469
if (ctx.colors) {
14701470
totalLength += removeColors(output[i]).length;
14711471
} else {
@@ -1579,7 +1579,7 @@ function formatWithOptions(inspectOptions, ...args) {
15791579
let tempStr;
15801580
let lastPos = 0;
15811581

1582-
for (var i = 0; i < first.length - 1; i++) {
1582+
for (let i = 0; i < first.length - 1; i++) {
15831583
if (first.charCodeAt(i) === 37) { // '%'
15841584
const nextChar = first.charCodeAt(++i);
15851585
if (a + 1 !== args.length) {

0 commit comments

Comments
 (0)