MCPcopy Index your code
hub / github.com/callumalpass/tasknotes / constructor

Method constructor

tests/__mocks__/ical.ts:42–69  ·  view source on GitHub ↗
(private jCal: any[] | string)

Source from the content-addressed store, hash-verified

40 private components = new Map<string, Component[]>();
41
42 constructor(private jCal: any[] | string) {
43 if (typeof jCal === 'string') {
44 this.jCal = [jCal, [], []];
45 } else if (Array.isArray(jCal) && jCal.length >= 3) {
46 // Reconstruct from jCal: [name, properties[], components[]]
47 const props = jCal[1] || [];
48 for (const prop of props) {
49 // prop: [name, params, type, value]
50 this.properties.set(prop[0], prop[3]);
51 if (prop[1] && Object.keys(prop[1]).length > 0) {
52 const propObj = new ICAL.Property(prop[0], prop[3], prop[1]);
53 if (!this.multiProperties.has(prop[0])) {
54 this.multiProperties.set(prop[0], []);
55 }
56 this.multiProperties.get(prop[0])!.push(propObj);
57 }
58 }
59 const subcomps = jCal[2] || [];
60 for (const sub of subcomps) {
61 const subComp = new Component(sub);
62 const type = sub[0];
63 if (!this.components.has(type)) {
64 this.components.set(type, []);
65 }
66 this.components.get(type)!.push(subComp);
67 }
68 }
69 }
70
71 static fromString(str: string): Component {
72 // Simple parsing for test purposes

Callers

nothing calls this directly

Calls 3

hasMethod · 0.80
setMethod · 0.65
getMethod · 0.65

Tested by

no test coverage detected