Skip to content
Permalink
Browse files

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>
  • Loading branch information
lmammino authored and MylesBorins committed Nov 12, 2019
1 parent 956207f commit 7421cc8fbdf0708b428c3c9e55d3d6e634db1498
Showing with 5 additions and 5 deletions.
  1. +5 −5 lib/internal/util/inspect.js
@@ -1133,7 +1133,7 @@ function formatPrimitive(fn, value, ctx) {

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

const remaining = valLen - len;
const output = [];
for (var i = 0; i < len; i++) {
for (let i = 0; i < len; i++) {
// Special handle sparse arrays.
if (!hasOwnProperty(value, i)) {
return formatSpecialArray(ctx, value, recurseTimes, len, output, i);
@@ -1297,7 +1297,7 @@ function formatSetIterInner(ctx, recurseTimes, entries, state) {
const maxLength = Math.min(maxArrayLength, entries.length);
let output = new Array(maxLength);
ctx.indentationLvl += 2;
for (var i = 0; i < maxLength; i++) {
for (let i = 0; i < maxLength; i++) {
output[i] = formatValue(ctx, entries[i], recurseTimes);
}
ctx.indentationLvl -= 2;
@@ -1465,7 +1465,7 @@ function isBelowBreakLength(ctx, output, start, base) {
let totalLength = output.length + start;
if (totalLength + output.length > ctx.breakLength)
return false;
for (var i = 0; i < output.length; i++) {
for (let i = 0; i < output.length; i++) {
if (ctx.colors) {
totalLength += removeColors(output[i]).length;
} else {
@@ -1579,7 +1579,7 @@ function formatWithOptions(inspectOptions, ...args) {
let tempStr;
let lastPos = 0;

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

0 comments on commit 7421cc8

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