hasAnsi
functionfunction hasAnsi(input: string): boolean
Check if string contains ANSI escape codes This is a fast check that looks for ESC characters without doing full parsing. Useful for conditionally processing strings.
Parameters
input
stringInput string to checkReturns
booleantrue if string contains ESC charactersExample
hasAnsi('\x1b[31mRed\x1b[0m') // => true
hasAnsi('Plain text') // => false
hasAnsi('') // => false