mirror of
https://gitlab.com/MrFry/mrfrys-node-server
synced 2025-04-01 20:24:18 +02:00
json schema json file checking, p2p fixes
This commit is contained in:
parent
5c22f575dd
commit
2edc87d5dd
7 changed files with 277 additions and 75 deletions
|
@ -419,10 +419,14 @@ function C(color?: string): string {
|
|||
return '\x1b[0m'
|
||||
}
|
||||
|
||||
function logTable(table: (string | number)[][]): void {
|
||||
function logTable(
|
||||
table: (string | number)[][],
|
||||
options: { colWidth?: number[] } = {}
|
||||
): void {
|
||||
table.forEach((row, i) => {
|
||||
const rowString: string[] = []
|
||||
row.forEach((cell, j) => {
|
||||
const { colWidth } = options
|
||||
const cellColor = j === 0 || i === 0 ? 'blue' : 'green'
|
||||
let cellVal = ''
|
||||
if (!isNaN(+cell)) {
|
||||
|
@ -430,6 +434,17 @@ function logTable(table: (string | number)[][]): void {
|
|||
} else {
|
||||
cellVal = cell.toString()
|
||||
}
|
||||
|
||||
if (colWidth[j]) {
|
||||
if (cellVal.length < colWidth[j]) {
|
||||
while (cellVal.length < colWidth[j]) {
|
||||
cellVal += ' '
|
||||
}
|
||||
} else if (cellVal.length > colWidth[j]) {
|
||||
cellVal = cellVal.substring(0, colWidth[j] - 3) + '...'
|
||||
}
|
||||
}
|
||||
|
||||
rowString.push(C(cellColor) + cellVal + C())
|
||||
})
|
||||
Log(rowString.join('\t'))
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue