Package to replace
has-ansi
Suggested replacement(s)
From chalk/strip-ansi#54
const hasAnsi = (string) => string.includes("\u001B") || string.includes("\u009B");
Manifest type
micro-utility (tiny utility replaceable with native code or removal)
Rationale
- This package using regex, which is slower for a non-ANSI string.
- New code only using
.includes(INTRODUCER), which is very small and should be inlined.
Availability
All modern enviroments that supports String.prototype.includes.
Code example (optional)
// import hasAnsi from "has-ansi";
const hasAnsi = (string) => string.includes("\u001B") || string.includes("\u009B");
console.log(hasAnsi("foo")); // false
console.log(hasAnsi("\x1b[31mfoo\x1b[39m")); // true
Package to replace
has-ansi
Suggested replacement(s)
From chalk/strip-ansi#54
Manifest type
micro-utility (tiny utility replaceable with native code or removal)
Rationale
.includes(INTRODUCER), which is very small and should be inlined.Availability
All modern enviroments that supports
String.prototype.includes.Code example (optional)