wrap-ansi 8.0.1 → 8.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 +41 -0
- package/package.json +9 -4
package/index.d.ts
ADDED
@@ -0,0 +1,41 @@
|
|
1
|
+
export type Options = {
|
2
|
+
/**
|
3
|
+
By default the wrap is soft, meaning long words may extend past the column width. Setting this to `true` will make it hard wrap at the column width.
|
4
|
+
|
5
|
+
@default false
|
6
|
+
*/
|
7
|
+
readonly hard?: boolean;
|
8
|
+
|
9
|
+
/**
|
10
|
+
By default, an attempt is made to split words at spaces, ensuring that they don't extend past the configured columns. If wordWrap is `false`, each column will instead be completely filled splitting words as necessary.
|
11
|
+
|
12
|
+
@default true
|
13
|
+
*/
|
14
|
+
readonly wordWrap?: boolean;
|
15
|
+
|
16
|
+
/**
|
17
|
+
Whitespace on all lines is removed by default. Set this option to `false` if you don't want to trim.
|
18
|
+
|
19
|
+
@default true
|
20
|
+
*/
|
21
|
+
readonly trim?: boolean;
|
22
|
+
};
|
23
|
+
|
24
|
+
/**
|
25
|
+
Wrap words to the specified column width.
|
26
|
+
|
27
|
+
@param string - String with ANSI escape codes. Like one styled by [`chalk`](https://github.com/chalk/chalk). Newline characters will be normalized to `\n`.
|
28
|
+
@param columns - Number of columns to wrap the text to.
|
29
|
+
|
30
|
+
@example
|
31
|
+
```
|
32
|
+
import chalk from 'chalk';
|
33
|
+
import wrapAnsi from 'wrap-ansi';
|
34
|
+
|
35
|
+
const input = 'The quick brown ' + chalk.red('fox jumped over ') +
|
36
|
+
'the lazy ' + chalk.green('dog and then ran away with the unicorn.');
|
37
|
+
|
38
|
+
console.log(wrapAnsi(input, 20));
|
39
|
+
```
|
40
|
+
*/
|
41
|
+
export default function wrapAnsi(string: string, columns: number, options?: Options): string;
|
package/package.json
CHANGED
@@ -1,6 +1,6 @@
|
|
1
1
|
{
|
2
2
|
"name": "wrap-ansi",
|
3
|
-
"version": "8.0
|
3
|
+
"version": "8.1.0",
|
4
4
|
"description": "Wordwrap a string with ANSI escape codes",
|
5
5
|
"license": "MIT",
|
6
6
|
"repository": "chalk/wrap-ansi",
|
@@ -11,15 +11,19 @@
|
|
11
11
|
"url": "https://sindresorhus.com"
|
12
12
|
},
|
13
13
|
"type": "module",
|
14
|
-
"exports":
|
14
|
+
"exports": {
|
15
|
+
"types": "./index.d.ts",
|
16
|
+
"default": "./index.js"
|
17
|
+
},
|
15
18
|
"engines": {
|
16
19
|
"node": ">=12"
|
17
20
|
},
|
18
21
|
"scripts": {
|
19
|
-
"test": "xo && nyc ava"
|
22
|
+
"test": "xo && nyc ava && tsd"
|
20
23
|
},
|
21
24
|
"files": [
|
22
|
-
"index.js"
|
25
|
+
"index.js",
|
26
|
+
"index.d.ts"
|
23
27
|
],
|
24
28
|
"keywords": [
|
25
29
|
"wrap",
|
@@ -59,6 +63,7 @@
|
|
59
63
|
"coveralls": "^3.1.1",
|
60
64
|
"has-ansi": "^5.0.1",
|
61
65
|
"nyc": "^15.1.0",
|
66
|
+
"tsd": "^0.25.0",
|
62
67
|
"xo": "^0.44.0"
|
63
68
|
}
|
64
69
|
}
|