Sha256: c5bb23b3ca69e97ddefdb76724b1a7936ac18b5e47c3fe3c5391969d6e6d06f8
Contents?: true
Size: 468 Bytes
Versions: 80
Compression:
Stored size: 468 Bytes
Contents
import ansiRegex from 'ansi-regex'; const regex = ansiRegex(); export default function stripAnsi(string) { if (typeof string !== 'string') { throw new TypeError(`Expected a \`string\`, got \`${typeof string}\``); } // 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, ''); }
Version data entries
80 entries across 25 versions & 1 rubygems