mirror of
https://github.com/documenso/documenso.git
synced 2025-11-10 04:22:32 +10:00
13 lines
369 B
TypeScript
13 lines
369 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: Recipient) => {
|
|
return extractInitials(recipient.name) || recipient.email.slice(0, 1).toUpperCase();
|
|
};
|