(str: string)
| 52 | } |
| 53 | |
| 54 | function hasMultipleCodepoints(str: string): boolean { |
| 55 | let count = 0 |
| 56 | for (const _ of str) { |
| 57 | count++ |
| 58 | if (count > 1) return true |
| 59 | } |
| 60 | return false |
| 61 | } |
| 62 | |
| 63 | function graphemeWidth(grapheme: string): 1 | 2 { |
| 64 | if (hasMultipleCodepoints(grapheme)) return 2 |