diff --git a/packages/frontend/src/utils/geInitials.ts b/packages/frontend/src/utils/geInitials.ts new file mode 100644 index 00000000..c78f8362 --- /dev/null +++ b/packages/frontend/src/utils/geInitials.ts @@ -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(''); +}