Skip to content

Commit aee4a30

Browse files
committedJun 19, 2023
deps: strip-ansi@7.1.0
1 parent 6105dbc commit aee4a30

File tree

5 files changed

+20
-10
lines changed

5 files changed

+20
-10
lines changed
 
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,14 @@
11
import ansiRegex from 'ansi-regex';
22

3+
const regex = ansiRegex();
4+
35
export default function stripAnsi(string) {
46
if (typeof string !== 'string') {
57
throw new TypeError(`Expected a \`string\`, got \`${typeof string}\``);
68
}
79

8-
return string.replace(ansiRegex(), '');
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, '');
914
}

‎node_modules/@isaacs/cliui/node_modules/strip-ansi/package.json

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "strip-ansi",
3-
"version": "7.0.1",
3+
"version": "7.1.0",
44
"description": "Strip ANSI escape codes from a string",
55
"license": "MIT",
66
"repository": "chalk/strip-ansi",
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,14 @@
11
import ansiRegex from 'ansi-regex';
22

3+
const regex = ansiRegex();
4+
35
export default function stripAnsi(string) {
46
if (typeof string !== 'string') {
57
throw new TypeError(`Expected a \`string\`, got \`${typeof string}\``);
68
}
79

8-
return string.replace(ansiRegex(), '');
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, '');
914
}

‎node_modules/wrap-ansi/node_modules/strip-ansi/package.json

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "strip-ansi",
3-
"version": "7.0.1",
3+
"version": "7.1.0",
44
"description": "Strip ANSI escape codes from a string",
55
"license": "MIT",
66
"repository": "chalk/strip-ansi",

‎package-lock.json

+6-6
Original file line numberDiff line numberDiff line change
@@ -1329,9 +1329,9 @@
13291329
}
13301330
},
13311331
"node_modules/@isaacs/cliui/node_modules/strip-ansi": {
1332-
"version": "7.0.1",
1333-
"resolved": "https://registry.npmjs.org/strip-ansi/-/strip-ansi-7.0.1.tgz",
1334-
"integrity": "sha512-cXNxvT8dFNRVfhVME3JAe98mkXDYN2O1l7jmcwMnOslDeESg1rF/OZMtK0nRAhiari1unG5cD4jG3rapUAkLbw==",
1332+
"version": "7.1.0",
1333+
"resolved": "https://registry.npmjs.org/strip-ansi/-/strip-ansi-7.1.0.tgz",
1334+
"integrity": "sha512-iq6eVVI64nQQTRYq2KtEg2d2uU7LElhTJwsH4YzIHZshxlgZms/wIc4VoDQTlG/IvVIrBKG06CrZnp0qv7hkcQ==",
13351335
"inBundle": true,
13361336
"dependencies": {
13371337
"ansi-regex": "^6.0.1"
@@ -15231,9 +15231,9 @@
1523115231
}
1523215232
},
1523315233
"node_modules/wrap-ansi/node_modules/strip-ansi": {
15234-
"version": "7.0.1",
15235-
"resolved": "https://registry.npmjs.org/strip-ansi/-/strip-ansi-7.0.1.tgz",
15236-
"integrity": "sha512-cXNxvT8dFNRVfhVME3JAe98mkXDYN2O1l7jmcwMnOslDeESg1rF/OZMtK0nRAhiari1unG5cD4jG3rapUAkLbw==",
15234+
"version": "7.1.0",
15235+
"resolved": "https://registry.npmjs.org/strip-ansi/-/strip-ansi-7.1.0.tgz",
15236+
"integrity": "sha512-iq6eVVI64nQQTRYq2KtEg2d2uU7LElhTJwsH4YzIHZshxlgZms/wIc4VoDQTlG/IvVIrBKG06CrZnp0qv7hkcQ==",
1523715237
"inBundle": true,
1523815238
"dependencies": {
1523915239
"ansi-regex": "^6.0.1"

0 commit comments

Comments
 (0)
Please sign in to comment.