Skip to main content

Function: stripAnsi()

stripAnsi(text): string
Defined in: sanitize.ts:427 Strips ANSI escape codes from a string. Useful for cleaning terminal output before logging to files.

Parameters

text

string The text potentially containing ANSI codes.

Returns

string The text with ANSI codes removed.

Example

stripAnsi('\x1b[31mRed text\x1b[0m'); // 'Red text'