UNPKG

783 BTypeScriptView Raw
1/**
2 * Generates borderless text table strings suitable for printing to stdout.
3 */
4declare function table(
5 /** An array of arrays containing strings, numbers, or other printable values. */
6 rows: Array<Array<{}>>,
7 /** A configuration object to customize table output. */
8 options?: table.Options,
9): string;
10
11declare namespace table {
12 interface Options {
13 /** Separator to use between columns, (default: ' '). */
14 hsep?: string | undefined;
15
16 /** An array of alignment types for each column, default ['l','l',...]. */
17 align?: Array<"l" | "r" | "c" | "." | null | undefined> | undefined;
18
19 /** A callback function to use when calculating the string length. */
20 stringLength?(str: string): number;
21 }
22}
23
24export = table;