Skip to content

Commit

Permalink
♻️ move calcColumnsSize()
Browse files Browse the repository at this point in the history
  • Loading branch information
astoilkov committed Jan 10, 2024
1 parent 342c0ff commit 79e964c
Showing 1 changed file with 10 additions and 10 deletions.
20 changes: 10 additions & 10 deletions src/extras/consoleTable.ts
Original file line number Diff line number Diff line change
Expand Up @@ -84,16 +84,6 @@ function flatObjectOrArray(
return spans;
}

function calcColumnsSize(rows: ConsoleText[][]): number[] {
const columns: number[] = [];
for (const row of rows) {
for (let i = 0; i < row.length; i++) {
columns[i] = Math.max(columns[i] ?? 0, row[i]!.text.length);
}
}
return columns;
}

function tableRow(
cells: ConsoleText[],
columnsSize: number[],
Expand All @@ -120,6 +110,16 @@ function tableRow(
return spans;
}

function calcColumnsSize(rows: ConsoleText[][]): number[] {
const columns: number[] = [];
for (const row of rows) {
for (let i = 0; i < row.length; i++) {
columns[i] = Math.max(columns[i] ?? 0, row[i]!.text.length);
}
}
return columns;
}

function getRowStyle(
row: "top" | "middle" | "bottom",
column: "left" | "middle" | "right",
Expand Down

0 comments on commit 79e964c

Please sign in to comment.