Repository navigation
v0.0.6
PATCH: a new export before 1.0. The new entry @mark1russell7/text/length has textLength, truncate and pad, and their types TextUnit, TextBoundary, TruncateOptions and PadOptions.
- Each function counts in UTF-16 code units, in code points or in graphemes. The graphemes come from
Intl.Segmenter. truncatecuts a text tomaxunits or fewer, with the mark "…" at the end. The cut keeps each grapheme whole by default, and it never splits a surrogate pair.padadds a fill at the start, at the end or at the two sides, to a width. It does not add a part of a grapheme of the fill.- The 18 copies of a cut in the atlas list are test fixtures.
test/cut-differences.tsgives each difference and its reason. - The entry
./lengthis 721 bytes afteresbuildandgzipat level 9, and a test holds it at 850 bytes or fewer. The root entry does not change.
Runtime dependencies: no change against 0.0.5 (none).