This repository has been archived on 2025-12-04. You can view files and clone it. You cannot open issues or pull requests or push a commit.
Files

15 lines
395 B
TypeScript
Raw Permalink Normal View History

2025-10-20 08:57:51 +02:00
export function getInitials(fullName?: string): string {
if (!fullName) return '';
const names = fullName.trim().split(' ');
if (names.length === 0) return '';
if (names.length === 1) return names[0].charAt(0).toUpperCase();
return `${names[0].charAt(0)}${names[names.length - 1].charAt(0)}`.toUpperCase();
}
export function useInitials() {
return { getInitials };
}