Files
sign/packages/lib/utils/recipient-formatter.ts

13 lines
379 B
TypeScript
Raw Normal View History

import type { Recipient } from '@documenso/prisma/client';
2023-09-12 12:33:04 +10: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) => {
return extractInitials(recipient.name) || recipient.email.slice(0, 1).toUpperCase();
2023-09-12 12:33:04 +10:00
};