master
export default function lengthInUtf8Bytes(str) { // Matches only the 10.. bytes that are non-initial characters in a multi-byte sequence. const m = encodeURIComponent(str).match(/%[89ABab]/g); return str.length + (m ? m.length : 0); }