@mantine/core
Version:
React components library focused on usability, accessibility and developer experience
11 lines (10 loc) • 416 B
JavaScript
"use client";
//#region packages/@mantine/core/src/components/Avatar/get-initials/get-initials.ts
function getInitials(name, limit = 2) {
const splitted = name.split(" ");
if (splitted.length === 1) return name.slice(0, limit).toUpperCase();
return splitted.map((word) => word[0]).slice(0, limit).join("").toUpperCase();
}
//#endregion
exports.getInitials = getInitials;
//# sourceMappingURL=get-initials.cjs.map