(str: string, pos: number)
| 12 | } |
| 13 | |
| 14 | export const isSurrogate = (str: string, pos: number): boolean => { |
| 15 | return ( |
| 16 | 0xd800 <= str.charCodeAt(pos - 1) && |
| 17 | str.charCodeAt(pos - 1) <= 0xdbff && |
| 18 | 0xdc00 <= str.charCodeAt(pos) && |
| 19 | str.charCodeAt(pos) <= 0xdfff |
| 20 | ) |
| 21 | } |
| 22 | |
| 23 | // alternative surrogate check mimicking the java implementation |
| 24 | // const TRAIL_SURROGATE_BITMASK = 0xfffffc00 |