(codePointValue: number)
| 1 | function numUtf8BytesForCodePoint(codePointValue: number): number { |
| 2 | if (codePointValue < 0x80) { |
| 3 | return 1; |
| 4 | } |
| 5 | if (codePointValue < 0x800) { |
| 6 | return 2; |
| 7 | } |
| 8 | if (codePointValue < 0x10000) { |
| 9 | return 3; |
| 10 | } |
| 11 | return 4; |
| 12 | } |
| 13 | |
| 14 | /** |
| 15 | * Calculates for some prefix of the given text, how many bytes the UTF-8 |
no outgoing calls
no test coverage detected