Skip to content

stripAnsiEscapes

stripAnsiEscapes(text): string

Defined in: packages/format-ansi/src/strip-ansi-escapes.ts:14

Strips ANSI/VT100 escape sequences (SGR colors, cursor moves, OSC 8 links).

A utility over AnsiDecoder: every token that is not text is dropped. Handles CSI (ESC [ and the 8-bit introducer) and OSC (ESC ], terminated by BEL or ST). An unterminated sequence at the end of the input is kept, on the grounds that it is indistinguishable from ordinary text at that point.

string

string