This repository has been archived by the owner on Nov 30, 2018. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 0
/
index.d.ts
125 lines (104 loc) · 2.32 KB
/
index.d.ts
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
// Type definitions for table-layout v0.2.3
// Project: https://github.com/75lb/table-layout
// Definitions by: Jordi Oliveras Rovira <https://github.com/j-oliveras>
declare namespace TableLayout {
export interface ColumnOptions {
/**
* Column name, must match a property name in the input.
*/
name: string;
/**
* Column width.
*/
width?: number;
/**
* Column min width.
*/
minWidth?: number;
/**
* Column max width.
*/
maxWidth?: number;
/**
* Disable wrapping for this column.
*/
noWrap?: boolean;
/**
* Disable line-trimming for this column.
*/
noTrim?: boolean;
/**
* Enable word-breaking for this columns.
*/
break?: boolean;
/**
* Padding options.
*/
padding?: {
/**
* A string to pad the left of each cell.
*
* @default ' '
*/
left?: string;
/**
* A string to pad the right of each cell.
*
* @default ' '
*/
right?: string;
};
}
export interface Options {
/**
* Maximum width of layout.
*/
maxWidth?: number;
/**
* Disable wrapping on all columns.
*/
noWrap?: boolean;
/**
* Disable line-trimming for this column.
*/
noTrim?: boolean;
/**
* Enable word-breaking on all columns.
*/
break?: boolean;
/**
* Options for a column.
*/
columns?: Array<ColumnOptions>;
/**
* If set, empty columns or columns containing only whitespace are not rendered.
*/
ignoreEmptyColumns?: boolean;
/**
* Padding values to set on each column.
* Per-column overrides can be set in the columns option.
*/
padding?: {
/**
* A string to pad the left of each cell.
*/
left?: string;
/**
* A string to pad the right of each cell.
*/
right?: string;
};
}
}
declare class TableLayout {
public constructor(data: Array<any>, options?: TableLayout.Options);
/**
* Identical to .toString() with the exception that the result will be an array of lines, rather than a single, multi-line string.
*/
public renderLines(): Array<string>;
/**
* Returns the input data as a text table.
*/
public toString(): string;
}
export = TableLayout;