@ende/text/truncate

ende add jsr:@ende/text

Version 2026.10.15 on JSR.

Exports

  • truncate — Truncates a string to at most `maxLength` UTF-16 code units. When truncation occurs the suffix is included within the `maxLength` budget. Surrogate pairs are never split, so the result may be shorter than `maxLength` when a cut would land inside a pair. When the suffix itself contains surrogate pairs and `maxLength` is very small, the result can even be empty.
  • TruncateOptions — Options for truncate.