tty-strings
Version: 
Tools for working with strings displayed in the terminal
21 lines • 719 B
TypeScript
/**
 * Split a string with ANSI escape codes into an array of lines. Supports both `CRLF` and `LF` newlines.
 *
 * @remarks
 * ANSI escape codes that are style and hyperlink sequences will be wrapped across the output lines,
 * while all other types of control sequences will be ignored but preserved in the output.
 *
 * @example
 * ```ts
 * import { splitLines } from 'tty-strings';
 * import chalk from 'chalk';
 *
 * splitLines(chalk.green('foo\nbar'));
 * // > ['\x1b[32mfoo\x1b[39m', '\x1b[32mbar\x1b[39m']
 * ```
 *
 * @param string - Input string to split.
 * @returns Array of lines in the input string.
 */
export default function splitLines(string: string): string[];
//# sourceMappingURL=splitLines.d.ts.map