Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

Commit 18e9b56

Browse filesBrowse files
lmamminoaddaleax
authored andcommitted
util: use let instead of var for util/inspect.js
PR-URL: #30399 Reviewed-By: James M Snell <jasnell@gmail.com> Reviewed-By: Colin Ihrig <cjihrig@gmail.com> Reviewed-By: Gireesh Punathil <gpunathi@in.ibm.com> Reviewed-By: Ruben Bridgewater <ruben@bridgewater.de> Reviewed-By: Trivikram Kamat <trivikr.dev@gmail.com>
1 parent 56248a8 commit 18e9b56
Copy full SHA for 18e9b56

File tree

Expand file treeCollapse file tree

1 file changed

+5
-5
lines changed
Open diff view settings
Filter options
Expand file treeCollapse file tree

1 file changed

+5
-5
lines changed
Open diff view settings
Collapse file

‎lib/internal/util/inspect.js‎

Copy file name to clipboardExpand all lines: lib/internal/util/inspect.js
+5-5Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1136,7 +1136,7 @@ function formatPrimitive(fn, value, ctx) {
11361136

11371137
function formatNamespaceObject(ctx, value, recurseTimes, keys) {
11381138
const output = new Array(keys.length);
1139-
for (var i = 0; i < keys.length; i++) {
1139+
for (let i = 0; i < keys.length; i++) {
11401140
try {
11411141
output[i] = formatProperty(ctx, value, recurseTimes, keys[i],
11421142
kObjectType);
@@ -1224,7 +1224,7 @@ function formatArray(ctx, value, recurseTimes) {
12241224

12251225
const remaining = valLen - len;
12261226
const output = [];
1227-
for (var i = 0; i < len; i++) {
1227+
for (let i = 0; i < len; i++) {
12281228
// Special handle sparse arrays.
12291229
if (!hasOwnProperty(value, i)) {
12301230
return formatSpecialArray(ctx, value, recurseTimes, len, output, i);
@@ -1300,7 +1300,7 @@ function formatSetIterInner(ctx, recurseTimes, entries, state) {
13001300
const maxLength = Math.min(maxArrayLength, entries.length);
13011301
let output = new Array(maxLength);
13021302
ctx.indentationLvl += 2;
1303-
for (var i = 0; i < maxLength; i++) {
1303+
for (let i = 0; i < maxLength; i++) {
13041304
output[i] = formatValue(ctx, entries[i], recurseTimes);
13051305
}
13061306
ctx.indentationLvl -= 2;
@@ -1468,7 +1468,7 @@ function isBelowBreakLength(ctx, output, start, base) {
14681468
let totalLength = output.length + start;
14691469
if (totalLength + output.length > ctx.breakLength)
14701470
return false;
1471-
for (var i = 0; i < output.length; i++) {
1471+
for (let i = 0; i < output.length; i++) {
14721472
if (ctx.colors) {
14731473
totalLength += removeColors(output[i]).length;
14741474
} else {
@@ -1589,7 +1589,7 @@ function formatWithOptionsInternal(inspectOptions, ...args) {
15891589
let tempStr;
15901590
let lastPos = 0;
15911591

1592-
for (var i = 0; i < first.length - 1; i++) {
1592+
for (let i = 0; i < first.length - 1; i++) {
15931593
if (first.charCodeAt(i) === 37) { // '%'
15941594
const nextChar = first.charCodeAt(++i);
15951595
if (a + 1 !== args.length) {

0 commit comments

Comments
0 (0)
Morty Proxy This is a proxified and sanitized view of the page, visit original site.