Check if a string has ANSI escape codes
$ npm install has-ansi
import hasAnsi from 'has-ansi';
hasAnsi('\u001B[4mUnicorn\u001B[0m');
//=> true
hasAnsi('cake');
//=> false
- has-ansi-cli - CLI for this module
- strip-ansi - Strip ANSI escape codes
- ansi-regex - Regular expression for matching ANSI escape codes
- chalk - Terminal string styling done right
Tidelift helps make open source sustainable for maintainers while giving companies
assurances about security, maintenance, and licensing for their dependencies.