initial commit
tests / ci (push) Failing after 2m23s

This commit is contained in:
2026-09-10 20:36:26 +02:00
commit 059b08b956
372 changed files with 36633 additions and 0 deletions
+29
View File
@@ -0,0 +1,29 @@
export type UseInitialsReturn = {
getInitials: (fullName?: string) => string;
};
function getInitial(name: string): string {
return Array.from(name)[0] ?? '';
}
export function getInitials(fullName?: string): string {
if (!fullName) {
return '';
}
const names = fullName.trim().split(/\s+/u).filter(Boolean);
if (names.length === 0) {
return '';
}
if (names.length === 1) {
return getInitial(names[0]).toUpperCase();
}
return `${getInitial(names[0])}${getInitial(names[names.length - 1])}`.toUpperCase();
}
export function useInitials(): UseInitialsReturn {
return { getInitials };
}