UNPKG
has-ansi
Version:
latest (6.0.2)
6.0.2
6.0.0
5.0.1
5.0.0
4.0.1
4.0.0
3.0.0
2.0.0
1.0.3
1.0.2
1.0.1
1.0.0
0.1.0
Check if a string has ANSI escape codes
github.com/chalk/has-ansi
chalk/has-ansi
has-ansi
/
index.js
8 lines
(5 loc)
•
154 B
JavaScript
View Raw
1
2
3
4
5
6
7
8
import ansiRegex
from
'ansi-regex'
;
const
regex
=
ansiRegex
({
onlyFirst
:
true
}); export
default
function
hasAnsi
(
string
)
{
return
regex.
test
(
string
); }