Skip to content

Commit

Permalink
Update index.js
Browse files Browse the repository at this point in the history
  • Loading branch information
sindresorhus committed May 27, 2023
1 parent f2b3e13 commit d54a07a
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions index.js
@@ -1,10 +1,11 @@
import ansiRegex from 'ansi-regex';

const re = ansiRegex();
const regex = ansiRegex();

export default function stripAnsi(string) {
if (typeof string !== 'string') {
throw new TypeError(`Expected a \`string\`, got \`${typeof string}\``);
}

return string.replace(re, '');
return string.replace(regex, '');
}

0 comments on commit d54a07a

Please sign in to comment.