slice-ansi 6.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.d.ts +19 -0
- package/package.json +14 -10
package/index.d.ts
ADDED
@@ -0,0 +1,19 @@
|
|
1
|
+
/**
|
2
|
+
Slice a string with [ANSI escape codes](https://en.wikipedia.org/wiki/ANSI_escape_code#Colors_and_Styles)
|
3
|
+
|
4
|
+
@param string - A string with ANSI escape codes. Like one styled by [`chalk`](https://github.com/chalk/chalk).
|
5
|
+
@param startSlice - Zero-based index at which to start the slice.
|
6
|
+
@param endSlice - Zero-based index at which to end the slice.
|
7
|
+
|
8
|
+
@example
|
9
|
+
```
|
10
|
+
import chalk from 'chalk';
|
11
|
+
import sliceAnsi from 'slice-ansi';
|
12
|
+
|
13
|
+
const string = 'The quick brown ' + chalk.red('fox jumped over ') +
|
14
|
+
'the lazy ' + chalk.green('dog and then ran away with the unicorn.');
|
15
|
+
|
16
|
+
console.log(sliceAnsi(string, 20, 30));
|
17
|
+
```
|
18
|
+
*/
|
19
|
+
export default function sliceAnsi(string: string, startSlice: number, endSlice?: number): string;
|
package/package.json
CHANGED
@@ -1,20 +1,24 @@
|
|
1
1
|
{
|
2
2
|
"name": "slice-ansi",
|
3
|
-
"version": "
|
3
|
+
"version": "7.1.0",
|
4
4
|
"description": "Slice a string with ANSI escape codes",
|
5
5
|
"license": "MIT",
|
6
6
|
"repository": "chalk/slice-ansi",
|
7
7
|
"funding": "https://github.com/chalk/slice-ansi?sponsor=1",
|
8
8
|
"type": "module",
|
9
|
-
"exports":
|
9
|
+
"exports": {
|
10
|
+
"types": "./index.d.ts",
|
11
|
+
"default": "./index.js"
|
12
|
+
},
|
10
13
|
"engines": {
|
11
|
-
"node": ">=
|
14
|
+
"node": ">=18"
|
12
15
|
},
|
13
16
|
"scripts": {
|
14
|
-
"test": "xo && ava"
|
17
|
+
"test": "xo && ava && tsc index.d.ts"
|
15
18
|
},
|
16
19
|
"files": [
|
17
|
-
"index.js"
|
20
|
+
"index.js",
|
21
|
+
"index.d.ts"
|
18
22
|
],
|
19
23
|
"keywords": [
|
20
24
|
"slice",
|
@@ -41,13 +45,13 @@
|
|
41
45
|
],
|
42
46
|
"dependencies": {
|
43
47
|
"ansi-styles": "^6.2.1",
|
44
|
-
"is-fullwidth-code-point": "^
|
48
|
+
"is-fullwidth-code-point": "^5.0.0"
|
45
49
|
},
|
46
50
|
"devDependencies": {
|
47
|
-
"ava": "^5.
|
48
|
-
"chalk": "^5.
|
51
|
+
"ava": "^5.3.1",
|
52
|
+
"chalk": "^5.3.0",
|
49
53
|
"random-item": "^4.0.1",
|
50
|
-
"strip-ansi": "^7.0
|
51
|
-
"xo": "^0.
|
54
|
+
"strip-ansi": "^7.1.0",
|
55
|
+
"xo": "^0.56.0"
|
52
56
|
}
|
53
57
|
}
|