has-ansi

v6.0.0
Check if a string has ANSI escape codes
ansi styles color colour colors terminal console string tty and 13 more...

has-ansi

Check if a string has ANSI escape codes

Install

npm install has-ansi

Usage

import hasAnsi from 'has-ansi';

hasAnsi('\u001B[4mUnicorn\u001B[0m');
//=> true

hasAnsi('cake');
//=> false

Related

npm i has-ansi

Metadata

  • MIT
  • >=18
  • Sindre Sorhus
  • released 7/10/2024

Downloads