Open cometkim opened 1 month ago
makes sense to me 👍
i think we'd add it to the preferred
manifest so we can document the fact there are two solutions (a native one for newer nodes, and a package for older ones). we can just list them as two alternatives
graphemer (22M weekly downloads on NPM) and grapheme-splitter (6M weekly downloads on NPM) are both for handling grapheme clusters (for counting the length of a Unicode text). But they're outdated, unmaintained for a long time.
The JavaScript's
Intl.Segmenter
API can replace those packages completely, and is supported by most modern browsers/Node.js/Deno/Bun.However, it might not be supported in older versions of browsers or some environments like React Native (Hermes). I created unicode-segmenter for those cases. It's compatible with the latest version of the Unicode specification, is way small, and is way performant.