| 2907 | return result + encoded; |
| 2908 | } |
| 2909 | function ucs2decode(string) { |
| 2910 | const output = []; |
| 2911 | let counter = 0; |
| 2912 | const length = string.length; |
| 2913 | while (counter < length) { |
| 2914 | const value = string.charCodeAt(counter++); |
| 2915 | if (value >= 55296 && value <= 56319 && counter < length) { |
| 2916 | const extra = string.charCodeAt(counter++); |
| 2917 | if ((extra & 64512) == 56320) { |
| 2918 | output.push(((value & 1023) << 10) + (extra & 1023) + 65536); |
| 2919 | } else { |
| 2920 | output.push(value); |
| 2921 | counter--; |
| 2922 | } |
| 2923 | } else { |
| 2924 | output.push(value); |
| 2925 | } |
| 2926 | } |
| 2927 | return output; |
| 2928 | } |
| 2929 | var ucs2encode = (codePoints) => String.fromCodePoint(...codePoints); |
| 2930 | var basicToDigit = function(codePoint) { |
| 2931 | if (codePoint >= 48 && codePoint < 58) { |