@dialpad/dialtone
Version:
Dialpad's Dialtone design system monorepo
11 lines (10 loc) • 424 B
JavaScript
//#region components/avatar/utils.js
var e = (e) => {
if (typeof e != "string" || !e.trim()) return "";
e = e.replace(/[^\p{L}\p{N}\s]/gu, "");
let t = e.trim().split(/\s+/g);
return t.length === 1 ? t.join("").substring(0, 2) : t.filter((e, n) => n === 0 || n === t.length - 1).map((e) => e.slice(0, 1).toUpperCase()).join("");
};
//#endregion
export { e as extractInitialsFromName };
//# sourceMappingURL=utils.js.map