2023-12-26 23:50:40 +00:00
|
|
|
import type { Recipient } from '@documenso/prisma/client';
|
2023-09-12 12:33:04 +10:00
|
|
|
|
2024-02-06 16:16:10 +11:00
|
|
|
export const extractInitials = (text: string) =>
|
2023-09-12 12:33:04 +10:00
|
|
|
text
|
|
|
|
|
.split(' ')
|
|
|
|
|
.map((name: string) => name.slice(0, 1).toUpperCase())
|
|
|
|
|
.slice(0, 2)
|
|
|
|
|
.join('');
|
|
|
|
|
|
|
|
|
|
export const recipientAbbreviation = (recipient: Recipient) => {
|
2024-02-06 16:16:10 +11:00
|
|
|
return extractInitials(recipient.name) || recipient.email.slice(0, 1).toUpperCase();
|
2023-09-12 12:33:04 +10:00
|
|
|
};
|