Skip to content

Commit 3f59704

Browse files
lmamminogireeshpunathil
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 ecfebee commit 3f59704

File tree

1 file changed

+5
-5
lines changed

1 file changed

+5
-5
lines changed

lib/internal/util/inspect.js

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1165,7 +1165,7 @@ function formatPrimitive(fn, value, ctx) {
11651165

11661166
function formatNamespaceObject(ctx, value, recurseTimes, keys) {
11671167
const output = new Array(keys.length);
1168-
for (var i = 0; i < keys.length; i++) {
1168+
for (let i = 0; i < keys.length; i++) {
11691169
try {
11701170
output[i] = formatProperty(ctx, value, recurseTimes, keys[i],
11711171
kObjectType);
@@ -1253,7 +1253,7 @@ function formatArray(ctx, value, recurseTimes) {
12531253

12541254
const remaining = valLen - len;
12551255
const output = [];
1256-
for (var i = 0; i < len; i++) {
1256+
for (let i = 0; i < len; i++) {
12571257
// Special handle sparse arrays.
12581258
if (!ObjectPrototypeHasOwnProperty(value, i)) {
12591259
return formatSpecialArray(ctx, value, recurseTimes, len, output, i);
@@ -1329,7 +1329,7 @@ function formatSetIterInner(ctx, recurseTimes, entries, state) {
13291329
const maxLength = MathMin(maxArrayLength, entries.length);
13301330
let output = new Array(maxLength);
13311331
ctx.indentationLvl += 2;
1332-
for (var i = 0; i < maxLength; i++) {
1332+
for (let i = 0; i < maxLength; i++) {
13331333
output[i] = formatValue(ctx, entries[i], recurseTimes);
13341334
}
13351335
ctx.indentationLvl -= 2;
@@ -1497,7 +1497,7 @@ function isBelowBreakLength(ctx, output, start, base) {
14971497
let totalLength = output.length + start;
14981498
if (totalLength + output.length > ctx.breakLength)
14991499
return false;
1500-
for (var i = 0; i < output.length; i++) {
1500+
for (let i = 0; i < output.length; i++) {
15011501
if (ctx.colors) {
15021502
totalLength += removeColors(output[i]).length;
15031503
} else {
@@ -1618,7 +1618,7 @@ function formatWithOptionsInternal(inspectOptions, ...args) {
16181618
let tempStr;
16191619
let lastPos = 0;
16201620

1621-
for (var i = 0; i < first.length - 1; i++) {
1621+
for (let i = 0; i < first.length - 1; i++) {
16221622
if (first.charCodeAt(i) === 37) { // '%'
16231623
const nextChar = first.charCodeAt(++i);
16241624
if (a + 1 !== args.length) {

0 commit comments

Comments
 (0)