(str: string)
| 90 | } |
| 91 | |
| 92 | function needsSegmentation(str: string): boolean { |
| 93 | for (const char of str) { |
| 94 | const cp = char.codePointAt(0)! |
| 95 | // Emoji ranges |
| 96 | if (cp >= 0x1f300 && cp <= 0x1faff) return true |
| 97 | if (cp >= 0x2600 && cp <= 0x27bf) return true |
| 98 | if (cp >= 0x1f1e6 && cp <= 0x1f1ff) return true |
| 99 | // Variation selectors, ZWJ |
| 100 | if (cp >= 0xfe00 && cp <= 0xfe0f) return true |
| 101 | if (cp === 0x200d) return true |
| 102 | } |
| 103 | return false |
| 104 | } |
| 105 | |
| 106 | function getEmojiWidth(grapheme: string): number { |
| 107 | // Regional indicators: single = 1, pair = 2 |
no outgoing calls
no test coverage detected