From daf27ca51792ccf1efdcab74b232728c2ad7f12f Mon Sep 17 00:00:00 2001 From: Tom Hacohen Date: Wed, 13 Dec 2017 11:13:11 +0000 Subject: [PATCH] ContactType: Add a way to clone. --- src/ical.js.d.ts | 4 ++++ src/pim-types.tsx | 4 ++++ 2 files changed, 8 insertions(+) diff --git a/src/ical.js.d.ts b/src/ical.js.d.ts index a87e499..9dfae0d 100644 --- a/src/ical.js.d.ts +++ b/src/ical.js.d.ts @@ -3,8 +3,12 @@ declare module 'ical.js' { class Component { name: string; + static fromString(str: string): Component; + constructor(jCal: Array | string, parent?: Component); + toJSON(): Array; + getFirstSubcomponent(name?: string): Component | null; getFirstPropertyValue(name?: string): any; diff --git a/src/pim-types.tsx b/src/pim-types.tsx index 29d9eda..55be069 100644 --- a/src/pim-types.tsx +++ b/src/pim-types.tsx @@ -39,6 +39,10 @@ export class ContactType { return this.comp.toString(); } + clone() { + return new ContactType(new ICAL.Component(this.comp.toJSON())); + } + get uid() { return this.comp.getFirstPropertyValue('uid'); }