UNPKG

1.05 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 | undefined;
21 /** @default true */
22 trim?: boolean | undefined;
23 /** @default true */
24 wordWrap?: boolean | undefined;
25 }
26}
27
28export default wrapAnsi;