Initial commit of the L'Ami Fiduciaire SaaS platform built on Laravel 12, Vue 3, Inertia.js 2, and Tailwind CSS 4. Story 0.1 (rename folders to declarations in database) is implemented and code-reviewed: migration, rollback, and 6 Pest tests all passing. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
19 lines
500 B
TypeScript
19 lines
500 B
TypeScript
export type UseInitialsReturn = {
|
|
getInitials: (fullName?: string) => string;
|
|
};
|
|
|
|
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(): UseInitialsReturn {
|
|
return { getInitials };
|
|
}
|