MCPcopy
hub / github.com/codeaashu/claude-code / firstGrapheme

Function firstGrapheme

src/utils/intl.ts:26–31  ·  view source on GitHub ↗
(text: string)

Source from the content-addressed store, hash-verified

24 * Returns '' for empty strings.
25 */
26export 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.

Callers 3

renderMethod · 0.85
executeReplaceFunction · 0.85
executeToggleCaseFunction · 0.85

Calls 3

getGraphemeSegmenterFunction · 0.85
segmentMethod · 0.80
nextMethod · 0.80

Tested by

no test coverage detected