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