7 lines
299 B
TypeScript
7 lines
299 B
TypeScript
import { stringifyCell } from '../shared/text';
|
|
|
|
export function normalizeRows(rows: unknown[][]): string[][] {
|
|
const width = rows.reduce((maximum, row) => Math.max(maximum, row.length), 0);
|
|
return rows.map(row => Array.from({ length: width }, (_, index) => stringifyCell(row[index] ?? '')));
|
|
}
|