File tree 1 file changed +5
-1
lines changed
1 file changed +5
-1
lines changed Original file line number Diff line number Diff line change @@ -12,6 +12,8 @@ npm install @cto.af/string-width
12
12
13
13
## API
14
14
15
+ Full [ documentation] ( https://cto-af.github.io/string-width/ ) is available.
16
+
15
17
``` js
16
18
import {StringWidth , AMBIGUOUS , POTENTIAL_EMOJI } from ' ../lib/index.js'
17
19
@@ -20,7 +22,7 @@ sw.width('foo') // 3
20
22
sw .width (' \u{1F4A9} ' ) // 2: Emoji take two cells
21
23
sw .width (' #\ufe0f\u20e3 ' ) // 2: More complicated emoji
22
24
sw .break (' foobar' , 3 ) // [
23
- // {string: 'foo', cells: 3, last: false },
25
+ // {string: 'foo', cells: 3},
24
26
// {string: 'bar', cells: 3, last: true}
25
27
// ]
26
28
@@ -56,6 +58,8 @@ const custom = new StringWidth({
56
58
emoji
57
59
- Since backspace has a negative width, ensure that the total width is never
58
60
less than zero.
61
+ - ANSI escape sequences are ignored for width, unless the ` includeANSI ` option
62
+ is enabled.
59
63
60
64
## Chinese, Japanese, or Korean (CJK) contexts
61
65
You can’t perform that action at this time.
0 commit comments