export function parse(phrase: string): string { const rxUp = /\p{Lu}/u; if (phrase === "") { return ""; } let sub = ""; const words = phrase.split(/[^\w]/) for (let word of words) { if (word === "") { continue; } const initial = word.substring(0, 1); sub += initial.toUpperCase(); let inUpGroup = rxUp.test(initial); for (let i = 1; i < word.length; i++) { const c = word.charAt(i); if (rxUp.test(c)) { if (inUpGroup) { continue; } sub += c; continue; } inUpGroup = false; } } return sub; }