File tree Expand file tree Collapse file tree 1 file changed +5
-1
lines changed
Expand file tree Collapse file tree 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
1212
1313## API
1414
15+ Full [ documentation] ( https://cto-af.github.io/string-width/ ) is available.
16+
1517``` js
1618import {StringWidth , AMBIGUOUS , POTENTIAL_EMOJI } from ' ../lib/index.js'
1719
@@ -20,7 +22,7 @@ sw.width('foo') // 3
2022sw .width (' \u{1F4A9} ' ) // 2: Emoji take two cells
2123sw .width (' #\ufe0f\u20e3 ' ) // 2: More complicated emoji
2224sw .break (' foobar' , 3 ) // [
23- // {string: 'foo', cells: 3, last: false },
25+ // {string: 'foo', cells: 3},
2426 // {string: 'bar', cells: 3, last: true}
2527 // ]
2628
@@ -56,6 +58,8 @@ const custom = new StringWidth({
5658 emoji
5759- Since backspace has a negative width, ensure that the total width is never
5860 less than zero.
61+ - ANSI escape sequences are ignored for width, unless the ` includeANSI ` option
62+ is enabled.
5963
6064## Chinese, Japanese, or Korean (CJK) contexts
6165
You can’t perform that action at this time.
0 commit comments