-
Notifications
You must be signed in to change notification settings - Fork 16
/
Copy pathstring-width.node.txt
35 lines (30 loc) · 2.21 KB
/
string-width.node.txt
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
┏━━━━━━━━━━━━━━━━━━┓
┃ STRING-WIDTH ┃
┗━━━━━━━━━━━━━━━━━━┛
ALTERNATIVES ==> # - string-width (preferred)
# - unicode-width (preferred with Deno)
VERSION ==> #7.2.0
STRING-WIDTH(STR[, OPTS])->NUM #Gets STR width:
# - ignoring:
# - C0|C1 control characters
# - zero-width Unicode chars (U-200b to U-200f, U-feff)
# - combining Unicode chars like accents
# - U-0300 to U-036f
# - U-1ab0 to U-1aff
# - U-1dc0 to U-1dff
# - U-20d0 to U-20ff
# - U-fe20 to U-fe2f
# - surrogate pairs (U-d800 to U-dfff)
# - variation selectors (U-fe00 to U-fe0f)
# - other invisible characters, using Default_Ignorable_Code_Point Unicode class
# - ANSI sequences (using STRIP-ANSI, see its doc)
# - unless OPTS.countAnsiEscapeCodes true
# - counting as 2:
# - fullwidth Unicode chars (using GET-EAST-ASIAN-WIDTH, see its doc)
# - emoji (using EMOJI-REGEX, see its doc)
# - handles characters >=U+10000
# - handles combining characters (variations selections, Thai combining characters)
# - by using Intl.Segmenter
OPTS.ambiguousIsNarrow #BOOL (def: true). See get-east-asian-width's OPTS.ambiguousAsWide (but inverted)
string-width STR #Same as CLI
#Package string-width-cli (4.0.0)