UNPKG

1.01 kBTypeScriptView Raw
1// Type definitions for wrap-ansi 8.0
2// Project: https://www.npmjs.com/package/wrap-ansi
3// Definitions by: Klaus Reimer <https://github.com/kayahr>
4// Piotr Błażejewicz <https://github.com/peterblazejewicz>
5// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
6
7/**
8 * Wrap words to the specified column width.
9 *
10 * @param input String with ANSI escape codes. Like one styled by chalk.
11 * @param columns Number of columns to wrap the text to.
12 * @param options By default the wrap is soft, meaning long words may extend past the column width. Setting
13 * this to true will make it hard wrap at the column width.
14 */
15declare function wrapAnsi(input: string, columns: number, options?: wrapAnsi.Options): string;
16
17declare namespace wrapAnsi {
18 interface Options {
19 /** @default false */
20 hard?: boolean;
21 /** @default true */
22 trim?: boolean;
23 /** @default true */
24 wordWrap?: boolean;
25 }
26}
27
28export default wrapAnsi;