In JavaScript there is not always a one-to-one relationship between string characters and what a user would call a separate visual "letter". Some symbols are represented by several characters. This can cause issues when splitting strings and inadvertently cutting a multi-char letter in half, or when you need the actual number of letters in a string.
We need to be able to tell the difference between a grapheme and a character when highlighting search results names. There is a unicode standard algorithm for breaking a string of characters into graphemes called UAX #29, and grapheme-splitter implements that standard.
Check List
[x] Have read over the source code, and we can maintain it
[x] Has had a release in the last year, or looks done and stable
Alternatives
No feasible alternatives except for having worse-quality text processing.
New Dependency
Name: grapheme-splitter URL: https://github.com/orling/grapheme-splitter
Focus
We need to be able to tell the difference between a grapheme and a character when highlighting search results names. There is a unicode standard algorithm for breaking a string of characters into graphemes called UAX #29, and
grapheme-splitter
implements that standard.Check List
Alternatives
No feasible alternatives except for having worse-quality text processing.