Closed cometkim closed 1 week 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
Yo, I recently update the unicode-segmenter, it now has 13% size of graphemer, 1/3 even when gzipped.
Do I need to make a PR to the module-replacements or something? Please let me know if I can help
Yes please
You would create a pr in the replacements repo which adds an entry to the preferred manifest (a JSON file). Then add some docs
If you look at any previous pr, you'll quickly understand what to do I think
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.