UNPKG

@rareelements/lydia

Version:
49 lines 1.65 kB
"use strict"; Object.defineProperty(exports, "__esModule", { value: true }); exports.Component = void 0; const PropertyType_1 = require("./PropertyType"); const CalendarUtils_1 = require("../CalendarUtils"); class Component { constructor(rawComponent, defaultTZ) { this.rawComponent = rawComponent; this.propertyIndex = new Map(); const props = rawComponent.properties; if (!props) return; props.forEach((p) => { const rich = CalendarUtils_1.CalendarUtils.enrichProperty(p, rawComponent, defaultTZ); // console.log("propertyIndex", rich.type) if (rich.type !== PropertyType_1.PropertyType.UNSUPPORTED) this.propertyIndex.set(rich.type, rich); }); } getRaw() { return this.rawComponent; } getName() { return this.rawComponent.name; } getType() { return this.rawComponent.name; } getSummary() { const prop = this.propertyIndex.get(PropertyType_1.PropertyType.SUMMARY); return prop ? prop.value : undefined; } getDescription() { const prop = this.propertyIndex.get(PropertyType_1.PropertyType.DESCRIPTION); return prop ? prop.value : undefined; } getRRule() { const prop = this.propertyIndex.get(PropertyType_1.PropertyType.RRULE); return prop; } getEnd() { return this.propertyIndex.get(PropertyType_1.PropertyType.DTEND); } getStart() { return this.propertyIndex.get(PropertyType_1.PropertyType.DTSTART); } } exports.Component = Component; //# sourceMappingURL=Component.js.map