Merge branch 'feat/inda-383-daily-stat' into 'main'
[ProtonMail-WebClient.git] / applications / calendar / src / app / components / eventModal / eventForm / propertiesToOrganizerModel.ts
blobb42bee517afedeec9cd4bf7a93d0f1ca071dac10
1 import { extractEmailAddress } from '@proton/shared/lib/calendar/vcalConverter';
2 import type { VcalOrganizerProperty } from '@proton/shared/lib/interfaces/calendar/VcalModel';
4 export const propertiesToOrganizerModel = (organizer?: VcalOrganizerProperty) => {
5     if (!organizer) {
6         return;
7     }
8     const email = extractEmailAddress(organizer);
9     if (email === undefined) {
10         throw new Error('Malformed organizer');
11     }
12     const { cn = '' } = organizer?.parameters || {};
13     return {
14         email,
15         cn,
16     };