Skip to content

Commit

Permalink
util: use let instead of var for util/inspect.js
Browse files Browse the repository at this point in the history
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]>
  • Loading branch information
lmammino authored and addaleax committed Nov 30, 2019
1 parent 56248a8 commit 18e9b56
Showing 1 changed file with 5 additions and 5 deletions.
10 changes: 5 additions & 5 deletions lib/internal/util/inspect.js
Original file line number Diff line number Diff line change
Expand Up @@ -1136,7 +1136,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);
Expand Down Expand Up @@ -1224,7 +1224,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);
Expand Down Expand Up @@ -1300,7 +1300,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;
Expand Down Expand Up @@ -1468,7 +1468,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 {
Expand Down Expand Up @@ -1589,7 +1589,7 @@ function formatWithOptionsInternal(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) {
Expand Down

0 comments on commit 18e9b56

Please sign in to comment.