(text: string)
| 24 | * Returns '' for empty strings. |
| 25 | */ |
| 26 | export function firstGrapheme(text: string): string { |
| 27 | if (!text) return '' |
| 28 | const segments = getGraphemeSegmenter().segment(text) |
| 29 | const first = segments[Symbol.iterator]().next().value |
| 30 | return first?.segment ?? '' |
| 31 | } |
| 32 | |
| 33 | /** |
| 34 | * Extract the last grapheme cluster from a string. |
no test coverage detected