gedcom.json 1.0.8 → 1.0.10

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (68) hide show
  1. package/README.md +246 -256
  2. package/dist/ToJSON/console.js +15 -12
  3. package/dist/ToJSON/console.js.map +1 -1
  4. package/dist/ToJSON/models/DefinitionCache.js.map +1 -1
  5. package/dist/ToJSON/models/LineParsingResult.js.map +1 -1
  6. package/dist/ToJSON/models/ParsedLine.js +1 -1
  7. package/dist/ToJSON/models/ParsedLine.js.map +1 -1
  8. package/dist/ToJSON/models/Parsing.js +8 -6
  9. package/dist/ToJSON/models/Parsing.js.map +1 -1
  10. package/dist/ToJSON/models/ParsingObject.js.map +1 -1
  11. package/dist/ToJSON/models/ParsingOptions.js.map +1 -1
  12. package/dist/ToJSON/models/ParsingPath.js.map +1 -1
  13. package/dist/ToJSON/models/ParsingResult.js.map +1 -1
  14. package/dist/ToJSON/models/StatisticLine.js.map +1 -1
  15. package/dist/ToJSON/models/Statistics.js +2 -2
  16. package/dist/ToJSON/models/Statistics.js.map +1 -1
  17. package/dist/ToJSON/models/Store.js +11 -11
  18. package/dist/ToJSON/models/Store.js.map +1 -1
  19. package/dist/ToJSON/models/TagDefinition.js +11 -11
  20. package/dist/ToJSON/models/TagDefinition.js.map +1 -1
  21. package/dist/ToJSON/parsing/lineHelper.js +8 -8
  22. package/dist/ToJSON/parsing/lineHelper.js.map +1 -1
  23. package/dist/ToJSON/parsing/lineValidation.js +6 -6
  24. package/dist/ToJSON/parsing/lineValidation.js.map +1 -1
  25. package/dist/ToJSON/parsing/parseDate.js +84 -84
  26. package/dist/ToJSON/parsing/parseDate.js.map +1 -1
  27. package/dist/ToJSON/parsing/parseLine.js +8 -8
  28. package/dist/ToJSON/parsing/parseLine.js.map +1 -1
  29. package/dist/ToJSON/parsing/parsing.js +17 -17
  30. package/dist/ToJSON/parsing/parsing.js.map +1 -1
  31. package/dist/ToJSON/parsing/processLine.js +18 -18
  32. package/dist/ToJSON/parsing/processLine.js.map +1 -1
  33. package/dist/ToJSON/processing/manipulateValues.js +9 -10
  34. package/dist/ToJSON/processing/manipulateValues.js.map +1 -1
  35. package/dist/ToJSON/processing/result.js +87 -80
  36. package/dist/ToJSON/processing/result.js.map +1 -1
  37. package/dist/common.js +5 -5
  38. package/dist/common.js.map +1 -1
  39. package/dist/console.js +4 -4
  40. package/dist/console.js.map +1 -1
  41. package/dist/index.js.map +1 -1
  42. package/options/version551.yaml +303 -296
  43. package/package.json +13 -8
  44. package/src/ToJSON/console.ts +67 -67
  45. package/src/ToJSON/models/DefinitionCache.ts +7 -7
  46. package/src/ToJSON/models/LineParsingResult.ts +7 -7
  47. package/src/ToJSON/models/ParsedLine.ts +35 -35
  48. package/src/ToJSON/models/Parsing.ts +45 -41
  49. package/src/ToJSON/models/ParsingObject.ts +16 -16
  50. package/src/ToJSON/models/ParsingOptions.ts +41 -41
  51. package/src/ToJSON/models/ParsingPath.ts +7 -7
  52. package/src/ToJSON/models/ParsingResult.ts +10 -10
  53. package/src/ToJSON/models/StatisticLine.ts +16 -16
  54. package/src/ToJSON/models/Statistics.ts +63 -63
  55. package/src/ToJSON/models/Store.ts +106 -108
  56. package/src/ToJSON/models/TagDefinition.ts +123 -122
  57. package/src/ToJSON/parsing/lineHelper.ts +21 -21
  58. package/src/ToJSON/parsing/lineValidation.ts +39 -40
  59. package/src/ToJSON/parsing/parseDate.ts +280 -286
  60. package/src/ToJSON/parsing/parseLine.ts +33 -33
  61. package/src/ToJSON/parsing/parsing.ts +134 -141
  62. package/src/ToJSON/parsing/processLine.ts +112 -109
  63. package/src/ToJSON/processing/manipulateValues.ts +52 -53
  64. package/src/ToJSON/processing/result.ts +247 -241
  65. package/src/common.ts +14 -14
  66. package/src/console.ts +7 -8
  67. package/src/index.ts +3 -6
  68. package/test.json +0 -323
@@ -5,75 +5,75 @@ import join from 'lodash/join';
5
5
  * Class with parsing statistics
6
6
  */
7
7
  export default class Statistics {
8
- constructor(){
9
- this.ParsedLines = [];
10
- this.IncorrectLines = [];
11
- this.NotParsedLines = [];
12
- this.NotParsedLinesWithoutGEDCOMTag = [];
13
- }
8
+ constructor() {
9
+ this.ParsedLines = [];
10
+ this.IncorrectLines = [];
11
+ this.NotParsedLines = [];
12
+ this.NotParsedLinesWithoutGEDCOMTag = [];
13
+ }
14
14
 
15
- /**
16
- * @returns list of all correct parsed lines
17
- */
18
- ParsedLines: StatisticLine[];
19
- /**
20
- * @returns list of all incorrect parsed lines
21
- */
22
- IncorrectLines: StatisticLine[];
23
- /**
24
- * @returns list of all not parsed lines
25
- */
26
- NotParsedLines: StatisticLine[];
15
+ /**
16
+ * @returns list of all correct parsed lines
17
+ */
18
+ ParsedLines: StatisticLine[];
19
+ /**
20
+ * @returns list of all incorrect parsed lines
21
+ */
22
+ IncorrectLines: StatisticLine[];
23
+ /**
24
+ * @returns list of all not parsed lines
25
+ */
26
+ NotParsedLines: StatisticLine[];
27
27
 
28
- /**
29
- * @returns list of all not parsed lines
30
- */
31
- NotParsedLinesWithoutGEDCOMTag: StatisticLine[];
28
+ /**
29
+ * @returns list of all not parsed lines
30
+ */
31
+ NotParsedLinesWithoutGEDCOMTag: StatisticLine[];
32
32
 
33
- /**
34
- * @returns a count of all correctly parsed lines
35
- */
36
- get ParsedLinesCount(): number {
37
- return this.ParsedLines.length;
38
- }
33
+ /**
34
+ * @returns a count of all correctly parsed lines
35
+ */
36
+ get ParsedLinesCount(): number {
37
+ return this.ParsedLines.length;
38
+ }
39
39
 
40
- /**
41
- * @returns a count of all incorrect parsed lines
42
- */
43
- get IncorrectLinesCount(): number {
44
- return this.IncorrectLines.length;
45
- }
40
+ /**
41
+ * @returns a count of all incorrect parsed lines
42
+ */
43
+ get IncorrectLinesCount(): number {
44
+ return this.IncorrectLines.length;
45
+ }
46
46
 
47
- /**
48
- * @returns a count of all not parsed lines
49
- */
50
- get NotParsedLinesCount(): number {
51
- return this.NotParsedLines.length;
52
- }
47
+ /**
48
+ * @returns a count of all not parsed lines
49
+ */
50
+ get NotParsedLinesCount(): number {
51
+ return this.NotParsedLines.length;
52
+ }
53
53
 
54
- /**
55
- * @returns a count of all not parsed lines
56
- */
57
- get NotParsedLinesWithoutGEDCOMTagCount(): number {
58
- return this.NotParsedLinesWithoutGEDCOMTag.length;
59
- }
54
+ /**
55
+ * @returns a count of all not parsed lines
56
+ */
57
+ get NotParsedLinesWithoutGEDCOMTagCount(): number {
58
+ return this.NotParsedLinesWithoutGEDCOMTag.length;
59
+ }
60
60
 
61
- /**
62
- * @returns a count of all processed lines
63
- */
64
- get LinesCount(): number {
65
- return this.ParsedLines.length + this.IncorrectLines.length + this.NotParsedLines.length + this.NotParsedLinesWithoutGEDCOMTag.length;
66
- }
61
+ /**
62
+ * @returns a count of all processed lines
63
+ */
64
+ get LinesCount(): number {
65
+ return this.ParsedLines.length + this.IncorrectLines.length + this.NotParsedLines.length + this.NotParsedLinesWithoutGEDCOMTag.length;
66
+ }
67
67
 
68
- /**
69
- * @returns a comma separated list of all not parsed line numbers
70
- */
71
- get NotParsedLinesList(): string {
72
- let lineNumbers: number[] = [];
73
- this.NotParsedLines.forEach(line => {
74
- lineNumbers.push(line.LineNumber);
75
- });
68
+ /**
69
+ * @returns a comma separated list of all not parsed line numbers
70
+ */
71
+ get NotParsedLinesList(): string {
72
+ let lineNumbers: number[] = [];
73
+ this.NotParsedLines.forEach((line) => {
74
+ lineNumbers.push(line.LineNumber);
75
+ });
76
76
 
77
- return join(lineNumbers, ", ");
78
- }
79
- }
77
+ return join(lineNumbers, ', ');
78
+ }
79
+ }
@@ -1,142 +1,140 @@
1
- import dropRight from "lodash/dropRight";
2
- import split from "lodash/split";
3
- import map from "lodash/map";
4
- import flattenDeep from "lodash/flattenDeep";
1
+ import dropRight from 'lodash/dropRight';
2
+ import split from 'lodash/split';
3
+ import map from 'lodash/map';
4
+ import flattenDeep from 'lodash/flattenDeep';
5
5
  import remove from 'lodash/remove';
6
6
  import find from 'lodash/find';
7
7
  import isEqual from 'lodash/isEqual';
8
8
 
9
- import objectPath from "object-path";
10
- import fclone from "fclone";
9
+ import objectPath from 'object-path';
10
+ import fclone from 'fclone';
11
11
 
12
- import TagDefinition from "./TagDefinition";
13
- import ParsedLine from "./ParsedLine";
14
- import ConvertToTime from "./converter/ConvertToTime";
15
- import ParsingObject from "./ParsingObject";
16
- import ParsingPath from "./ParsingPath";
12
+ import TagDefinition from './TagDefinition';
13
+ import ParsedLine from './ParsedLine';
14
+ import ConvertToTime from './converter/ConvertToTime';
15
+ import ParsingObject from './ParsingObject';
16
+ import ParsingPath from './ParsingPath';
17
17
 
18
- import { CreateResult } from "../processing/result";
19
- import { IsEmpty } from "../../common";
20
- import { AddStartWith, ManipulateValue } from "../processing/manipulateValues";
21
- import DefinitionCache from "./DefinitionCache";
18
+ import { CreateResult } from '../processing/result';
19
+ import { IsEmpty } from '../../common';
20
+ import { AddStartWith, ManipulateValue } from '../processing/manipulateValues';
21
+ import DefinitionCache from './DefinitionCache';
22
22
 
23
23
  export default class Store {
24
- constructor() {
25
- this.objects = [];
26
- this.path = [];
27
- this.isParsing = false;
28
- this.stopParsingTillLevel = undefined;
29
- }
30
-
31
- private objects: ParsingObject[];
32
- /*
24
+ constructor() {
25
+ this.objects = [];
26
+ this.path = [];
27
+ this.isParsing = false;
28
+ this.stopParsingTillLevel = undefined;
29
+ }
30
+
31
+ private objects: ParsingObject[];
32
+ /*
33
33
  the actual parsed path
34
34
  */
35
- private path: ParsingPath[];
35
+ private path: ParsingPath[];
36
36
 
37
- /*
37
+ /*
38
38
  if true the line will be parsed, when false all lines will be ignored until a new defined tag with level 0 is found
39
39
  */
40
- private isParsing: Boolean;
40
+ private isParsing: Boolean;
41
41
 
42
- private stopParsingTillLevel?: Number;
42
+ private stopParsingTillLevel?: Number;
43
43
 
44
- private definitionCache: DefinitionCache[] = [];
44
+ private definitionCache: DefinitionCache[] = [];
45
45
 
46
- AddDefinitionToCache(path: string[], definition: any) {
47
- this.definitionCache.push(new DefinitionCache(path, definition));
48
- }
46
+ AddDefinitionToCache(path: string[], definition: any) {
47
+ this.definitionCache.push(new DefinitionCache(path, definition));
48
+ }
49
49
 
50
- GetDefinitionFromCache(path: string[]) {
51
- return find(this.definitionCache, x => isEqual(path, x.Path))
52
- }
50
+ GetDefinitionFromCache(path: string[]) {
51
+ return find(this.definitionCache, (x) => isEqual(path, x.Path));
52
+ }
53
53
 
54
- AddTempPath() {
55
- this.path.push(new ParsingPath("TEMP", ""));
56
- }
54
+ AddTempPath() {
55
+ this.path.push(new ParsingPath('TEMP', ''));
56
+ }
57
57
 
58
- StartParsing(definition: TagDefinition, line: ParsedLine) {
59
- this.isParsing = true;
60
- this.path.push(new ParsingPath(definition.Tag, definition.Path));
61
-
62
- // concat path and remove empty values
63
- let path = flattenDeep(map(fclone(this.path), x => split(x.Path, ".")));
64
- remove(path, x => IsEmpty(x));
65
-
66
- let obj = new ParsingObject(definition, line, path);
67
-
68
- // if no value is set, but the value should start with a specific value -> set the value and remove the property
69
- if (!(line.ReferenceId || line.Value)) {
70
- line.Value = AddStartWith(definition.StartWith, line.Value);
71
- definition.StartWith = undefined;
72
- }
73
-
74
- if (definition.Property && (line.ReferenceId || line.Value)) {
75
- if (definition.CollectAs) {
76
- objectPath.set(obj.Object, definition.Property, ManipulateValue(definition, line));
77
- }
78
- else {
79
- obj.Object = ManipulateValue(definition, line);
80
- }
81
- }
82
- else {
83
- // time has no own property, but must be merged with the last date
84
- if (definition.ConvertTo instanceof ConvertToTime) {
85
- ManipulateValue(definition, line);
86
- }
87
- }
88
-
89
- this.objects.push(obj);
90
- }
58
+ StartParsing(definition: TagDefinition, line: ParsedLine) {
59
+ this.isParsing = true;
60
+ this.path.push(new ParsingPath(definition.Tag, definition.Path));
91
61
 
92
- IsParsing(): Boolean {
93
- return this.isParsing;
94
- }
62
+ // concat path and remove empty values
63
+ let path = flattenDeep(map(fclone(this.path), (x) => split(x.Path, '.')));
64
+ remove(path, (x) => IsEmpty(x));
95
65
 
96
- DropRightPath(number?: number) {
97
- if (!number) {
98
- this.path = dropRight(this.path, number);
99
- return;
100
- }
101
-
102
- this.path = dropRight(this.path, this.path.length - number);
103
- }
66
+ let obj = new ParsingObject(definition, line, path);
104
67
 
105
- GetPath() {
106
- return this.path;
68
+ // if no value is set, but the value should start with a specific value -> set the value and remove the property
69
+ if (!(line.ReferenceId || line.Value)) {
70
+ line.Value = AddStartWith(definition.StartWith, line.Value);
71
+ definition.StartWith = undefined;
107
72
  }
108
73
 
109
- CreateResultObject() {
110
- return CreateResult(this.objects);
74
+ if (definition.Property && (line.ReferenceId || line.Value)) {
75
+ if (definition.CollectAs) {
76
+ objectPath.set(obj.Object, definition.Property, ManipulateValue(definition, line));
77
+ } else {
78
+ obj.Object = ManipulateValue(definition, line);
79
+ }
80
+ } else {
81
+ // time has no own property, but must be merged with the last date
82
+ if (definition.ConvertTo instanceof ConvertToTime) {
83
+ ManipulateValue(definition, line);
84
+ }
111
85
  }
112
86
 
113
- StopParsingUntilLevel(level: Number) {
114
- this.stopParsingTillLevel = level;
87
+ this.objects.push(obj);
88
+ }
89
+
90
+ IsParsing(): Boolean {
91
+ return this.isParsing;
92
+ }
93
+
94
+ DropRightPath(number?: number) {
95
+ if (!number) {
96
+ this.path = dropRight(this.path, number);
97
+ return;
115
98
  }
116
99
 
117
- ShouldParseLine(level: Number): Boolean {
118
- if (!this.stopParsingTillLevel) {
119
- return true;
120
- }
100
+ this.path = dropRight(this.path, this.path.length - number);
101
+ }
121
102
 
122
- if (level <= this.stopParsingTillLevel) {
123
- this.stopParsingTillLevel = 0;
124
- return true;
125
- }
103
+ GetPath() {
104
+ return this.path;
105
+ }
126
106
 
127
- return false;
128
- }
107
+ CreateResultObject() {
108
+ return CreateResult(this.objects);
109
+ }
110
+
111
+ StopParsingUntilLevel(level: Number) {
112
+ this.stopParsingTillLevel = level;
113
+ }
129
114
 
130
- Reset() {
131
- this.isParsing = false;
132
- this.path = [];
133
- this.stopParsingTillLevel = undefined;
134
- this.definitionCache = [];
115
+ ShouldParseLine(level: Number): Boolean {
116
+ if (!this.stopParsingTillLevel) {
117
+ return true;
135
118
  }
136
119
 
137
- FullReset() {
138
- this.Reset();
139
- this.objects = [];
140
- this.definitionCache = [];
120
+ if (level <= this.stopParsingTillLevel) {
121
+ this.stopParsingTillLevel = 0;
122
+ return true;
141
123
  }
142
- }
124
+
125
+ return false;
126
+ }
127
+
128
+ Reset() {
129
+ this.isParsing = false;
130
+ this.path = [];
131
+ this.stopParsingTillLevel = undefined;
132
+ this.definitionCache = [];
133
+ }
134
+
135
+ FullReset() {
136
+ this.Reset();
137
+ this.objects = [];
138
+ this.definitionCache = [];
139
+ }
140
+ }
@@ -1,144 +1,145 @@
1
- import isObject from "lodash/isObject";
1
+ import isObject from 'lodash/isObject';
2
2
 
3
- import ConvertTo from "./converter/ConvertTo";
4
- import ConvertToArray from "./converter/ConvertToArray";
5
- import ConvertToDate from "./converter/ConvertToDate";
6
- import ConvertToString from "./converter/ConvertToString";
7
- import ConvertToTime from "./converter/ConvertToTime";
3
+ import ConvertTo from './converter/ConvertTo';
4
+ import ConvertToArray from './converter/ConvertToArray';
5
+ import ConvertToDate from './converter/ConvertToDate';
6
+ import ConvertToString from './converter/ConvertToString';
7
+ import ConvertToTime from './converter/ConvertToTime';
8
8
 
9
9
  export default class TagDefinition {
10
- constructor(plainJsObject: any) {
11
- this.CollectAs = plainJsObject.CollectAs;
12
- this.Tag = plainJsObject.Tag;
13
- this.MergeWithLast = plainJsObject.MergeWithLast?.toString();
14
- this.MergeWithNext = plainJsObject.MergeWithNext;
15
- this.Type = plainJsObject.Type;
16
- this.IsSingleValue = plainJsObject.IsSingleValue;
17
- this.CollectAsArray = plainJsObject.CollectAsArray === true;
18
- this.StartWith = plainJsObject.StartWith;
19
-
20
- if (isObject(plainJsObject.Property)) {
21
- let propertyWithOption = new PropertyWithOption(plainJsObject.Property);
22
- this.Property = propertyWithOption.Name;
23
- this.PropertyType = propertyWithOption.Type;
24
- }
25
- else {
26
- this.Property = plainJsObject.Property;
27
- }
28
-
29
- if (plainJsObject.Replace) {
30
- this.Replace = new ReplaceValue(plainJsObject.Replace.Value, plainJsObject.Replace.With);
31
- }
32
-
33
- if (plainJsObject.StripHtml) {
34
- this.StripHtml = plainJsObject.StripHtml;
35
- }
36
-
37
- this.ConvertTo = CreateConvertTo(plainJsObject.Type, plainJsObject.ConvertTo);
10
+ constructor(plainJsObject: any) {
11
+ this.CollectAs = plainJsObject.CollectAs;
12
+ this.Tag = plainJsObject.Tag;
13
+ this.MergeWithLast = plainJsObject.MergeWithLast?.toString();
14
+ this.MergeWithNext = plainJsObject.MergeWithNext;
15
+ this.Type = plainJsObject.Type;
16
+ this.IsSingleValue = plainJsObject.IsSingleValue;
17
+ this.CollectAsArray = plainJsObject.CollectAsArray === true;
18
+ this.StartWith = plainJsObject.StartWith;
19
+
20
+ if (isObject(plainJsObject.Property)) {
21
+ let propertyWithOption = new PropertyWithOption(plainJsObject.Property);
22
+ this.Property = propertyWithOption.Name;
23
+ this.PropertyType = propertyWithOption.Type;
24
+ } else {
25
+ this.Property = plainJsObject.Property;
38
26
  }
39
27
 
40
- CollectAs?: string;
41
- StartWith?: string;
42
- CollectAsArray?: Boolean;
43
- Property?: string;
44
- Tag: string = "";
45
- MergeWithLast?: string;
46
- Replace?: ReplaceValue;
47
- StripHtml?: Boolean;
48
- ConvertTo?: ConvertTo;
49
- Type?: string;
50
- MergeWithNext?: string;
51
- IsSingleValue?: Boolean;
52
- PropertyType?: ConvertTo;
53
-
54
- get Path(): string {
55
- return this.CollectAs ?? this.Property ?? "";
28
+ if (plainJsObject.Replace) {
29
+ this.Replace = new ReplaceValue(plainJsObject.Replace.Value, plainJsObject.Replace.With);
56
30
  }
57
- }
58
31
 
59
- class ReplaceValue {
60
- constructor(value: string, withProperty: string) {
61
- this.Value = value;
62
- this.With = withProperty;
32
+ if (plainJsObject.StripHtml) {
33
+ this.StripHtml = plainJsObject.StripHtml;
63
34
  }
64
35
 
65
- Value: string;
66
- With: string;
36
+ this.ConvertTo = CreateConvertTo(plainJsObject.Type, plainJsObject.ConvertTo);
37
+ }
38
+
39
+ CollectAs?: string;
40
+ StartWith?: string;
41
+ CollectAsArray?: Boolean;
42
+ Property?: string;
43
+ Tag: string = '';
44
+ MergeWithLast?: string;
45
+ Replace?: ReplaceValue;
46
+ StripHtml?: Boolean;
47
+ ConvertTo?: ConvertTo;
48
+ Type?: string;
49
+ MergeWithNext?: string;
50
+ IsSingleValue?: Boolean;
51
+ PropertyType?: ConvertTo;
52
+
53
+ get Path(): string {
54
+ return this.CollectAs ?? this.Property ?? '';
55
+ }
67
56
  }
68
57
 
69
- class PropertyWithOption {
70
- constructor(property: any) {
71
- this.Name = property.Name;
72
-
73
- if (property.Type) {
74
- this.Type = CreateConvertTo(property.Type);
75
- return;
76
- }
77
-
78
- this.Type = CreateConvertTo(undefined, property.ConvertTo);
79
- }
58
+ class ReplaceValue {
59
+ constructor(value: string, withProperty: string) {
60
+ this.Value = value;
61
+ this.With = withProperty;
62
+ }
80
63
 
81
- Name?: string;
82
- Type?: ConvertTo;
64
+ Value: string;
65
+ With: string;
83
66
  }
84
67
 
85
- function CreateConvertTo(type?: string, convertTo?: any) : ConvertTo | undefined {
86
- let setConvertToDate = () : ConvertToDate => {
87
- return new ConvertToDate(convertTo?.About,
88
- convertTo?.Calculated,
89
- convertTo?.Estimated,
90
- convertTo?.Before,
91
- convertTo?.After,
92
- convertTo?.Between,
93
- convertTo?.And,
94
- convertTo?.Interpreted,
95
- convertTo?.From,
96
- convertTo?.To,
97
- convertTo?.Value,
98
- convertTo?.HasMonth,
99
- convertTo?.HasYear,
100
- convertTo?.HasDay,
101
- convertTo?.Original,
102
- convertTo?.Calendar);
103
- }
68
+ class PropertyWithOption {
69
+ constructor(property: any) {
70
+ this.Name = property.Name;
104
71
 
105
- let setConvertToString = () : ConvertToString => {
106
- return new ConvertToString(convertTo?.NewLineCharacter, convertTo?.NewLineIfEmpty);
72
+ if (property.Type) {
73
+ this.Type = CreateConvertTo(property.Type);
74
+ return;
107
75
  }
108
76
 
109
- let setConvertToArray = () : ConvertToArray => {
110
- return new ConvertToArray(convertTo?.Delimiter);
111
- }
77
+ this.Type = CreateConvertTo(undefined, property.ConvertTo);
78
+ }
112
79
 
113
- let setConvertToTime = () : ConvertToTime => {
114
- return new ConvertToTime();
115
- }
80
+ Name?: string;
81
+ Type?: ConvertTo;
82
+ }
116
83
 
117
- if (type) {
118
- switch(type) {
119
- case "Date":
120
- return setConvertToDate();
121
- case "String":
122
- return setConvertToString();
123
- case "Array":
124
- return setConvertToArray();
125
- case "Time":
126
- return setConvertToTime();
127
- }
84
+ function CreateConvertTo(type?: string, convertTo?: any): ConvertTo | undefined {
85
+ let setConvertToDate = (): ConvertToDate => {
86
+ return new ConvertToDate(
87
+ convertTo?.About,
88
+ convertTo?.Calculated,
89
+ convertTo?.Estimated,
90
+ convertTo?.Before,
91
+ convertTo?.After,
92
+ convertTo?.Between,
93
+ convertTo?.And,
94
+ convertTo?.Interpreted,
95
+ convertTo?.From,
96
+ convertTo?.To,
97
+ convertTo?.Value,
98
+ convertTo?.HasMonth,
99
+ convertTo?.HasYear,
100
+ convertTo?.HasDay,
101
+ convertTo?.Original,
102
+ convertTo?.Calendar
103
+ );
104
+ };
105
+
106
+ let setConvertToString = (): ConvertToString => {
107
+ return new ConvertToString(convertTo?.NewLineCharacter, convertTo?.NewLineIfEmpty);
108
+ };
109
+
110
+ let setConvertToArray = (): ConvertToArray => {
111
+ return new ConvertToArray(convertTo?.Delimiter);
112
+ };
113
+
114
+ let setConvertToTime = (): ConvertToTime => {
115
+ return new ConvertToTime();
116
+ };
117
+
118
+ if (type) {
119
+ switch (type) {
120
+ case 'Date':
121
+ return setConvertToDate();
122
+ case 'String':
123
+ return setConvertToString();
124
+ case 'Array':
125
+ return setConvertToArray();
126
+ case 'Time':
127
+ return setConvertToTime();
128
128
  }
129
-
130
- if (convertTo) {
131
- switch(convertTo.Type) {
132
- case "String":
133
- return setConvertToString();
134
- case "Date":
135
- return setConvertToDate();
136
- case "Array":
137
- return setConvertToArray();
138
- case "Time":
139
- return setConvertToTime();
140
- }
129
+ }
130
+
131
+ if (convertTo) {
132
+ switch (convertTo.Type) {
133
+ case 'String':
134
+ return setConvertToString();
135
+ case 'Date':
136
+ return setConvertToDate();
137
+ case 'Array':
138
+ return setConvertToArray();
139
+ case 'Time':
140
+ return setConvertToTime();
141
141
  }
142
+ }
142
143
 
143
- return;
144
- }
144
+ return;
145
+ }