(str: string, idx: number)
| 31 | const classTrie = new UnicodeTrie(data); |
| 32 | |
| 33 | const codePointAt = (str: string, idx: number) => { |
| 34 | // different from String#codePointAt with low surrogate |
| 35 | const code = str.charCodeAt(idx); |
| 36 | // High surrogate |
| 37 | if (0xd800 <= code && code <= 0xdbff) { |
| 38 | const hi = code; |
| 39 | const low = str.charCodeAt(idx + 1); |
| 40 | if (0xdc00 <= low && low <= 0xdfff) { |
| 41 | return (hi - 0xd800) * 0x400 + (low - 0xdc00) + 0x10000; |
| 42 | } |
| 43 | return hi; |
| 44 | } |
| 45 | // Low surrogate |
| 46 | if (0xdc00 <= code && code <= 0xdfff) { |
| 47 | const hi = str.charCodeAt(idx - 1); |
| 48 | const low = code; |
| 49 | if (0xd800 <= hi && hi <= 0xdbff) { |
| 50 | return (hi - 0xd800) * 0x400 + (low - 0xdc00) + 0x10000; |
| 51 | } |
| 52 | return low; |
| 53 | } |
| 54 | return code; |
| 55 | }; |
| 56 | |
| 57 | const isSurrogate = (str: string, pos: number) => { |
| 58 | let ref, ref1; |
no outgoing calls
no test coverage detected
searching dependent graphs…