UNPKG

932 BTypeScriptView Raw
1declare namespace columns {
2 export interface ColumnOptions {
3 /**
4 * align: Possible options: `'left'`, `'right'` (defaults to `'left'`)
5 */
6 align?: "left" | "right" | undefined;
7 }
8
9 export interface ColumnsOptions {
10 /**
11 * Custom colums separator (defaults to `|`)
12 */
13 sep?: string | undefined;
14 /**
15 * columns: Per column customizations, as e.g. `[{ align: 'right' }, null, { align: 'left' }]`
16 */
17 columns?: Array<ColumnOptions | null> | undefined;
18 }
19
20 export type Row = Iterable<any> | ArrayLike<any>;
21 export type Data = Iterable<Row> | ArrayLike<Row>;
22}
23
24/**
25 * Outputs aligned table of columns.
26 */
27declare function columns(data: ReadonlyArray<readonly any[]>, options?: columns.ColumnsOptions): string;
28declare function columns(data: columns.Data, options?: columns.ColumnsOptions): string;
29export = columns;