cli-truncate 2.0.0 → 2.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.
Files changed (2) hide show
  1. package/package.json +6 -5
  2. package/readme.md +17 -8
package/package.json CHANGED
@@ -1,9 +1,10 @@
1
1
  {
2
2
  "name": "cli-truncate",
3
- "version": "2.0.0",
3
+ "version": "2.1.0",
4
4
  "description": "Truncate a string to a specific width in the terminal",
5
5
  "license": "MIT",
6
6
  "repository": "sindresorhus/cli-truncate",
7
+ "funding": "https://github.com/sponsors/sindresorhus",
7
8
  "author": {
8
9
  "name": "Sindre Sorhus",
9
10
  "email": "sindresorhus@gmail.com",
@@ -34,12 +35,12 @@
34
35
  "string"
35
36
  ],
36
37
  "dependencies": {
37
- "slice-ansi": "^2.1.0",
38
- "string-width": "^4.1.0"
38
+ "slice-ansi": "^3.0.0",
39
+ "string-width": "^4.2.0"
39
40
  },
40
41
  "devDependencies": {
41
42
  "ava": "^2.1.0",
42
- "tsd": "^0.7.2",
43
- "xo": "^0.24.0"
43
+ "tsd": "^0.11.0",
44
+ "xo": "^0.25.3"
44
45
  }
45
46
  }
package/readme.md CHANGED
@@ -4,14 +4,12 @@
4
4
 
5
5
  Gracefully handles [ANSI escapes](https://en.wikipedia.org/wiki/ANSI_escape_code#Colors_and_Styles). Like a string styled with [`chalk`](https://github.com/chalk/chalk). It also supports Unicode surrogate pairs and fullwidth characters.
6
6
 
7
-
8
7
  ## Install
9
8
 
10
9
  ```
11
10
  $ npm install cli-truncate
12
11
  ```
13
12
 
14
-
15
13
  ## Usage
16
14
 
17
15
  ```js
@@ -47,7 +45,6 @@ cliTruncate(paragraph, process.stdout.columns));
47
45
  //=> 'Lorem ipsum dolor sit amet, consectetuer adipiscing…'
48
46
  ```
49
47
 
50
-
51
48
  ## API
52
49
 
53
50
  ### cliTruncate(text, columns, options?)
@@ -70,15 +67,15 @@ Type: `object`
70
67
 
71
68
  ##### position
72
69
 
73
- Type: `string`<br>
74
- Default: `'end'`<br>
70
+ Type: `string`\
71
+ Default: `'end'`\
75
72
  Values: `'start'` `'middle'` `'end'`
76
73
 
77
74
  Position to truncate the string.
78
75
 
79
76
  ##### space
80
77
 
81
- Type: `boolean`<br>
78
+ Type: `boolean`\
82
79
  Default: `false`
83
80
 
84
81
  Add a space between the text and the ellipsis.
@@ -99,7 +96,7 @@ cliTruncate('unicorns', 7, {position: 'middle', space: true});
99
96
 
100
97
  ##### preferTruncationOnSpace
101
98
 
102
- Type: `boolean`<br>
99
+ Type: `boolean`\
103
100
  Default: `false`
104
101
 
105
102
  Truncate the string from a whitespace if it is within 3 characters from the actual breaking point.
@@ -123,8 +120,20 @@ cliTruncate('unicorns rainbow dragons', 6, {position: 'middle', preferTruncation
123
120
  //=> 'uni…ns'
124
121
  ```
125
122
 
126
-
127
123
  ## Related
128
124
 
129
125
  - [wrap-ansi](https://github.com/chalk/wrap-ansi) - Wordwrap a string with ANSI escape codes
130
126
  - [slice-ansi](https://github.com/chalk/slice-ansi) - Slice a string with ANSI escape codes
127
+
128
+
129
+ ---
130
+
131
+ <div align="center">
132
+ <b>
133
+ <a href="https://tidelift.com/subscription/pkg/npm-cli-truncate?utm_source=npm-cli-truncate&utm_medium=referral&utm_campaign=readme">Get professional support for this package with a Tidelift subscription</a>
134
+ </b>
135
+ <br>
136
+ <sub>
137
+ Tidelift helps make open source sustainable for maintainers while giving companies<br>assurances about security, maintenance, and licensing for their dependencies.
138
+ </sub>
139
+ </div>