mirror of
https://github.com/documenso/documenso
synced 2026-04-21 21:37:18 +00:00
12 lines
393 B
TypeScript
12 lines
393 B
TypeScript
import type { Recipient } from '@prisma/client';
|
|
|
|
export const extractInitials = (text: string) =>
|
|
text
|
|
.split(' ')
|
|
.map((name: string) => name.slice(0, 1).toUpperCase())
|
|
.slice(0, 2)
|
|
.join('');
|
|
|
|
export const recipientAbbreviation = (recipient: Pick<Recipient, 'name' | 'email'>) => {
|
|
return extractInitials(recipient.name) || recipient.email.slice(0, 1).toUpperCase();
|
|
};
|