init commit
This commit is contained in:
commit
c9d982669a
461 changed files with 30317 additions and 0 deletions
14
resources/js/hooks/useInitials.ts
Normal file
14
resources/js/hooks/useInitials.ts
Normal file
|
@ -0,0 +1,14 @@
|
|||
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 };
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue