1 | "use strict";
|
2 | Object.defineProperty(exports, "__esModule", { value: true });
|
3 | class ReflectionCategory {
|
4 | constructor(title) {
|
5 | this.children = [];
|
6 | this.title = title;
|
7 | this.allChildrenHaveOwnDocument = (() => this.getAllChildrenHaveOwnDocument());
|
8 | }
|
9 | getAllChildrenHaveOwnDocument() {
|
10 | let onlyOwnDocuments = true;
|
11 | this.children.forEach((child) => {
|
12 | onlyOwnDocuments = onlyOwnDocuments && !!child.hasOwnDocument;
|
13 | });
|
14 | return onlyOwnDocuments;
|
15 | }
|
16 | toObject() {
|
17 | const result = {
|
18 | title: this.title
|
19 | };
|
20 | if (this.children) {
|
21 | const children = [];
|
22 | this.children.forEach((child) => {
|
23 | children.push(child.id);
|
24 | });
|
25 | result['children'] = children;
|
26 | }
|
27 | return result;
|
28 | }
|
29 | }
|
30 | exports.ReflectionCategory = ReflectionCategory;
|
31 |
|
\ | No newline at end of file |