UNPKG

1.03 kBTypeScriptView Raw
1interface TransformResult {
2 /**
3 * the amount of indentation to use. Default is 0 when an object is returned.
4 */
5 indent: number;
6 /**
7 * the character to use for indentation. Default is '' (empty string) when an object is returned.
8 */
9 character: string;
10 /**
11 * leading characters to use at the beginning of each line. '' (empty string) when an object is returned.
12 */
13 prefix: string;
14}
15
16interface Callback {
17 /**
18 * @param len the length of the "current" line
19 * @param longest the length of the longest line
20 * @param line the current line (string) being aligned
21 * @param lines the array of all lines
22 * @param idx the index of the current line
23 */
24 (len: number, longest: number, line: string, lines: string[], idx: number):
25 | number
26 | TransformResult;
27}
28
29declare function align_text(text: string, fn?: number | Callback): string;
30declare function align_text(text: any[], fn?: number | Callback): string[];
31
32export = align_text;