UNPKG

@dialpad/dialtone-vue

Version:

Vue component library for Dialpad's design system Dialtone

11 lines (10 loc) 384 B
const n = (t) => { if (typeof t != "string" || !t.trim()) return ""; t = t.replace(/[^\p{L}\p{N}\s]/gu, ""); const r = t.trim().split(/\s+/g); return r.length === 1 ? r.join("").substring(0, 2) : r.filter((s, i) => i === 0 || i === r.length - 1).map((s) => s.slice(0, 1).toUpperCase()).join(""); }; export { n as extractInitialsFromName }; //# sourceMappingURL=utils.js.map