1 // https://mathiasbynens.be/notes/javascript-encoding
2 // https://github.com/bestiejs/punycode.js - punycode.ucs2.decode
3 export default function ucs2length(str: string): number {
10 value = str.charCodeAt(pos++)
11 if (value >= 0xd800 && value <= 0xdbff && pos < len) {
12 // high surrogate, and there is a next character
13 value = str.charCodeAt(pos)
14 if ((value & 0xfc00) === 0xdc00) pos++ // low surrogate
20 ucs2length.code = 'require("ajv/dist/runtime/ucs2length").default'