UNPKG

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