Files
documenso/packages/lib/utils/recipient-formatter.ts
David Nguyen d546907c53 feat: wip
2023-12-27 17:44:36 +11:00

13 lines
379 B
TypeScript

import type { Recipient } from '@documenso/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: Recipient) => {
return extractInitials(recipient.name) || recipient.email.slice(0, 1).toUpperCase();
};