strip-ansi 7.0.0 → 7.1.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/index.js +6 -1
- package/package.json +4 -4
package/index.js
CHANGED
|
@@ -1,9 +1,14 @@
|
|
|
1
1
|
import ansiRegex from 'ansi-regex';
|
|
2
2
|
|
|
3
|
+
const regex = ansiRegex();
|
|
4
|
+
|
|
3
5
|
export default function stripAnsi(string) {
|
|
4
6
|
if (typeof string !== 'string') {
|
|
5
7
|
throw new TypeError(`Expected a \`string\`, got \`${typeof string}\``);
|
|
6
8
|
}
|
|
7
9
|
|
|
8
|
-
|
|
10
|
+
// Even though the regex is global, we don't need to reset the `.lastIndex`
|
|
11
|
+
// because unlike `.exec()` and `.test()`, `.replace()` does it automatically
|
|
12
|
+
// and doing it manually has a performance penalty.
|
|
13
|
+
return string.replace(regex, '');
|
|
9
14
|
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "strip-ansi",
|
|
3
|
-
"version": "7.
|
|
3
|
+
"version": "7.1.0",
|
|
4
4
|
"description": "Strip ANSI escape codes from a string",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"repository": "chalk/strip-ansi",
|
|
@@ -47,11 +47,11 @@
|
|
|
47
47
|
"text"
|
|
48
48
|
],
|
|
49
49
|
"dependencies": {
|
|
50
|
-
"ansi-regex": "^6.0.
|
|
50
|
+
"ansi-regex": "^6.0.1"
|
|
51
51
|
},
|
|
52
52
|
"devDependencies": {
|
|
53
53
|
"ava": "^3.15.0",
|
|
54
|
-
"tsd": "^0.
|
|
55
|
-
"xo": "^0.
|
|
54
|
+
"tsd": "^0.17.0",
|
|
55
|
+
"xo": "^0.44.0"
|
|
56
56
|
}
|
|
57
57
|
}
|