Files
agency/.pnpm-store/v11/files/d6/795f2ddb1ce4dd0beec89cedb564e412183192cba97b4ca2baa7ba443638247cdcd87182e4680647d4f30b90c41c361a542b07d3c77eeec307c4689d76b052
hanzo-agent 5af6960b87 run project
Run: sess_f37640604ae254cb4d11dc6217f7b721
2026-09-30 00:04:56 +00:00

15 lines
468 B
Plaintext

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, '');
}