Skip to content

Commit 79a36a6

Browse files
committed
make use of the block scoping nature of let
1 parent 424a0ae commit 79a36a6

1 file changed

Lines changed: 7 additions & 10 deletions

File tree

lib/Stats.js

Lines changed: 7 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -398,26 +398,23 @@ class Stats {
398398
};
399399

400400
const table = (array, align, splitter) => {
401-
let row;
402401
const rows = array.length;
403-
let col;
404402
const cols = array[0].length;
405403
const colSizes = new Array(cols);
406-
let value;
407-
for(col = 0; col < cols; col++)
404+
for(let col = 0; col < cols; col++)
408405
colSizes[col] = 0;
409-
for(row = 0; row < rows; row++) {
410-
for(col = 0; col < cols; col++) {
411-
value = `${getText(array, row, col)}`;
406+
for(let row = 0; row < rows; row++) {
407+
for(let col = 0; col < cols; col++) {
408+
const value = `${getText(array, row, col)}`;
412409
if(value.length > colSizes[col]) {
413410
colSizes[col] = value.length;
414411
}
415412
}
416413
}
417-
for(row = 0; row < rows; row++) {
418-
for(col = 0; col < cols; col++) {
414+
for(let row = 0; row < rows; row++) {
415+
for(let col = 0; col < cols; col++) {
419416
const format = array[row][col].color;
420-
value = `${getText(array, row, col)}`;
417+
const value = `${getText(array, row, col)}`;
421418
let l = value.length;
422419
if(align[col] === "l")
423420
format(value);

0 commit comments

Comments
 (0)