src/core/grapheme-splitter.js
// Breaks the given string into an array of grapheme cluster strings
Breaks the given string into an array of grapheme cluster strings
Breaks the given string into an array of grapheme cluster strings
function splitGraphemes(str) {
    if (/^[\x20-\xFF]*$/.test(str)) return str;
    const res = [];
    let index = 0;
    let brk;
    while ((brk = nextBreak(str, index)) < str.length) {
        res.push(str.slice(index, brk));
        index = brk;
    }
    if (index < str.length) {
        res.push(str.slice(index));
    }
    return res;
}
function splitGraphemes ( str ) { if ( / ^[\x20-\xFF]*$ / . test ( str ) ) return str ; const res = [ ] ; let index = 0 ; let brk ; while ( ( brk = nextBreak ( str , index ) ) < str . length ) { res . push ( str . slice ( index , brk ) ) ; index = brk ; } if ( index < str . length ) { res . push ( str . slice ( index ) ) ; } return res ; }
Breaks the given string into an array of grapheme cluster strings
Breaks the given string into an array of grapheme cluster strings
// If it's all ASCII, short-circuit the grapheme splitting...