⚡️ feat: create getInitials
util function
This commit is contained in:
parent
4ca1a4bcfd
commit
44e38740a2
13
packages/frontend/src/utils/geInitials.ts
Normal file
13
packages/frontend/src/utils/geInitials.ts
Normal file
@ -0,0 +1,13 @@
|
||||
/**
|
||||
* Get initials from a full name.
|
||||
*
|
||||
* @param {string} name - The full name string from which to get the initials.
|
||||
* @returns {string} A string of initials.
|
||||
*/
|
||||
export function getInitials(name: string): string {
|
||||
return name
|
||||
.split(' ')
|
||||
.filter((n) => n)
|
||||
.map((n) => n[0].toUpperCase())
|
||||
.join('');
|
||||
}
|
Loading…
Reference in New Issue
Block a user