(str: string, len: number, offset: number)
| 475 | * get the code point that begins at offset `offset` |
| 476 | */ |
| 477 | export function getNextCodePoint(str: string, len: number, offset: number): number { |
| 478 | const charCode = str.charCodeAt(offset); |
| 479 | if (isHighSurrogate(charCode) && offset + 1 < len) { |
| 480 | const nextCharCode = str.charCodeAt(offset + 1); |
| 481 | if (isLowSurrogate(nextCharCode)) { |
| 482 | return computeCodePoint(charCode, nextCharCode); |
| 483 | } |
| 484 | } |
| 485 | return charCode; |
| 486 | } |
| 487 | |
| 488 | /** |
| 489 | * get the code point that ends right before offset `offset` |
no test coverage detected