strip-ansi 5.1.0 → 5.2.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.d.ts +15 -0
- package/index.js +4 -1
- package/package.json +8 -6
- package/readme.md +2 -2
package/index.d.ts
ADDED
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
/**
|
|
2
|
+
Strip [ANSI escape codes](https://en.wikipedia.org/wiki/ANSI_escape_code) from a string.
|
|
3
|
+
|
|
4
|
+
@example
|
|
5
|
+
```
|
|
6
|
+
import stripAnsi from 'strip-ansi';
|
|
7
|
+
|
|
8
|
+
stripAnsi('\u001B[4mUnicorn\u001B[0m');
|
|
9
|
+
//=> 'Unicorn'
|
|
10
|
+
|
|
11
|
+
stripAnsi('\u001B]8;;https://github.com\u0007Click\u001B]8;;\u0007');
|
|
12
|
+
//=> 'Click'
|
|
13
|
+
```
|
|
14
|
+
*/
|
|
15
|
+
export default function stripAnsi(string: string): string;
|
package/index.js
CHANGED
|
@@ -1,4 +1,7 @@
|
|
|
1
1
|
'use strict';
|
|
2
2
|
const ansiRegex = require('ansi-regex');
|
|
3
3
|
|
|
4
|
-
|
|
4
|
+
const stripAnsi = string => typeof string === 'string' ? string.replace(ansiRegex(), '') : string;
|
|
5
|
+
|
|
6
|
+
module.exports = stripAnsi;
|
|
7
|
+
module.exports.default = stripAnsi;
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "strip-ansi",
|
|
3
|
-
"version": "5.
|
|
4
|
-
"description": "Strip ANSI escape codes",
|
|
3
|
+
"version": "5.2.0",
|
|
4
|
+
"description": "Strip ANSI escape codes from a string",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"repository": "chalk/strip-ansi",
|
|
7
7
|
"author": {
|
|
@@ -13,10 +13,11 @@
|
|
|
13
13
|
"node": ">=6"
|
|
14
14
|
},
|
|
15
15
|
"scripts": {
|
|
16
|
-
"test": "xo && ava"
|
|
16
|
+
"test": "xo && ava && tsd-check"
|
|
17
17
|
},
|
|
18
18
|
"files": [
|
|
19
|
-
"index.js"
|
|
19
|
+
"index.js",
|
|
20
|
+
"index.d.ts"
|
|
20
21
|
],
|
|
21
22
|
"keywords": [
|
|
22
23
|
"strip",
|
|
@@ -46,7 +47,8 @@
|
|
|
46
47
|
"ansi-regex": "^4.1.0"
|
|
47
48
|
},
|
|
48
49
|
"devDependencies": {
|
|
49
|
-
"ava": "^
|
|
50
|
-
"
|
|
50
|
+
"ava": "^1.3.1",
|
|
51
|
+
"tsd-check": "^0.5.0",
|
|
52
|
+
"xo": "^0.24.0"
|
|
51
53
|
}
|
|
52
54
|
}
|
package/readme.md
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
# strip-ansi [](https://travis-ci.org/chalk/strip-ansi)
|
|
2
2
|
|
|
3
|
-
> Strip [ANSI escape codes](https://en.wikipedia.org/wiki/ANSI_escape_code)
|
|
3
|
+
> Strip [ANSI escape codes](https://en.wikipedia.org/wiki/ANSI_escape_code) from a string
|
|
4
4
|
|
|
5
5
|
---
|
|
6
6
|
|
|
@@ -31,7 +31,7 @@ const stripAnsi = require('strip-ansi');
|
|
|
31
31
|
stripAnsi('\u001B[4mUnicorn\u001B[0m');
|
|
32
32
|
//=> 'Unicorn'
|
|
33
33
|
|
|
34
|
-
stripAnsi('\u001B]8;;https://github.com\
|
|
34
|
+
stripAnsi('\u001B]8;;https://github.com\u0007Click\u001B]8;;\u0007');
|
|
35
35
|
//=> 'Click'
|
|
36
36
|
```
|
|
37
37
|
|