UNPKG

has-ansi

Version:

Check if a string has ANSI escape codes

8 lines (5 loc) 154 B
import ansiRegex from 'ansi-regex'; const regex = ansiRegex({onlyFirst: true}); export default function hasAnsi(string) { return regex.test(string); }