-
Notifications
You must be signed in to change notification settings - Fork 15
Expand file tree
/
Copy pathslice-ansi.node.txt
More file actions
16 lines (13 loc) · 1001 Bytes
/
slice-ansi.node.txt
File metadata and controls
16 lines (13 loc) · 1001 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
┏━━━━━━━━━━━━━━━━┓
┃ SLICE-ANSI ┃
┗━━━━━━━━━━━━━━━━┛
VERSION ==> #7.1.0
SLICE-ANSI(STR, NUM[, NUM2])->STR #Like STR.slice(NUM[, NUM2]), but handles:
# - ANSI sequences (only \e[~m)
# - counted as 0 width
# - not cut in the middle, nor leaving start sequence without end sequence
# - using ANSI-STYLES (see its doc)
# - fullwidth code points
# - counted as 2 widths
# - using IS-FULLWIDTH-CODE-POINT and ASTRAL-REGEX (see their doc)
#Duration is O(NUM2), so faster to slice the beginning than the end