strip-ansi
Advanced tools
Comparing version 7.0.1 to 7.1.0
import ansiRegex from 'ansi-regex'; | ||
const regex = ansiRegex(); | ||
export default function stripAnsi(string) { | ||
@@ -8,3 +10,6 @@ if (typeof string !== 'string') { | ||
return string.replace(ansiRegex(), ''); | ||
// Even though the regex is global, we don't need to reset the `.lastIndex` | ||
// because unlike `.exec()` and `.test()`, `.replace()` does it automatically | ||
// and doing it manually has a performance penalty. | ||
return string.replace(regex, ''); | ||
} |
{ | ||
"name": "strip-ansi", | ||
"version": "7.0.1", | ||
"version": "7.1.0", | ||
"description": "Strip ANSI escape codes from a string", | ||
@@ -5,0 +5,0 @@ "license": "MIT", |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
4321
23