graphemes
graphemes(
value,locale?):string[]
Defined in: src/strings/random-string.ts:32
Split value into grapheme clusters — what a reader calls “characters”.
A flag or an emoji with a skin-tone modifier is several code points that display as one glyph; splitting on code points would break them apart. This exists to build an alphabet string can then draw from.
Parameters
Section titled “Parameters”string
locale?
Section titled “locale?”string
Returns
Section titled “Returns”string[]
Example
Section titled “Example”graphemes("👍🏽🎉"); // [ "👍🏽", "🎉" ], not four separate code pointsstring(5, graphemes("👍🏽🎉")); // a 5-emoji string, skin tones intact