export class ChapterFilter { type: string; code: string; name: string; parent: string; doc: any[]; static transform(chapters: any[]): ChapterFilter[] { let result = []; chapters.forEach(ch => { if (ch.children) { ch.children.forEach(s => { result.push(new ChapterFilter(ch.name, s.chapterCode, s.name, ch.name, s.doc)); }); } }); return result; } constructor(type: string, code: string, name: string, parent: string, doc: any[]) { this.type = type; this.code = code; this.name = name; this.parent = parent; if (doc) { this.doc = doc; } } }