style: run prettier formatter over src and tests

This commit is contained in:
2026-06-11 20:46:00 +05:30
parent 2389d4f297
commit 6b564a4569
211 changed files with 6134 additions and 4234 deletions
+14 -7
View File
@@ -14,10 +14,11 @@ export function toAsciiTable(rows: string[][]): string {
const pad = rightAlign
? (s: string, w: number) => s.padStart(w)
: (s: string, w: number) => s.padEnd(w);
const lines = rows.map((row) =>
'| ' +
Array.from({ length: numCols }, (_, c) => pad(row[c] ?? '', widths[c])).join(' | ') +
' |'
const lines = rows.map(
(row) =>
'| ' +
Array.from({ length: numCols }, (_, c) => pad(row[c] ?? '', widths[c])).join(' | ') +
' |'
);
// Insert separator after first row
const sep =
@@ -35,10 +36,16 @@ const TABLE_RE = /^\|.+\|\n^\|[\s:|-]+\|\n((?:^\|.+\|\n?)+)/gm;
export function applyAsciiTransform(source: string): string {
return source.replace(TABLE_RE, (block) => {
const lines = block.trim().split('\n');
const header = lines[0].slice(1, -1).split('|').map((s) => s.trim());
const header = lines[0]
.slice(1, -1)
.split('|')
.map((s) => s.trim());
const body = lines.slice(2).map((l) =>
l.slice(1, -1).split('|').map((s) => s.trim())
l
.slice(1, -1)
.split('|')
.map((s) => s.trim())
);
return '```\n' + toAsciiTable([header, ...body]) + '\n```';
});
}
}