typia 4.0.0 → 4.0.1

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 (87) hide show
  1. package/lib/programmers/ApplicationProgrammer.js +1 -1
  2. package/lib/programmers/internal/application_array.js +19 -41
  3. package/lib/programmers/internal/application_array.js.map +1 -1
  4. package/lib/programmers/internal/application_definition.d.ts +1 -1
  5. package/lib/programmers/internal/application_definition.js +8 -8
  6. package/lib/programmers/internal/application_definition.js.map +1 -1
  7. package/lib/programmers/internal/application_native.js +3 -3
  8. package/lib/programmers/internal/application_object.js +4 -4
  9. package/lib/programmers/internal/application_schema.js +3 -3
  10. package/lib/programmers/internal/application_schema.js.map +1 -1
  11. package/lib/programmers/internal/application_tuple.js +8 -30
  12. package/lib/programmers/internal/application_tuple.js.map +1 -1
  13. package/lib/schemas/IJsonComponents.d.ts +1 -12
  14. package/lib/schemas/IJsonSchema.d.ts +1 -1
  15. package/package.json +1 -1
  16. package/src/IRandomGenerator.ts +34 -34
  17. package/src/factories/IdentifierFactory.ts +65 -65
  18. package/src/factories/MetadataCollection.ts +254 -254
  19. package/src/factories/MetadataFactory.ts +40 -40
  20. package/src/factories/MetadataTagFactory.ts +300 -300
  21. package/src/factories/internal/metadata/emplace_metadata_array.ts +34 -34
  22. package/src/factories/internal/metadata/emplace_metadata_definition.ts +35 -35
  23. package/src/factories/internal/metadata/emplace_metadata_object.ts +142 -142
  24. package/src/factories/internal/metadata/emplace_metadata_tuple.ts +50 -50
  25. package/src/factories/internal/metadata/explore_metadata.ts +66 -66
  26. package/src/factories/internal/metadata/iterate_metadata.ts +77 -77
  27. package/src/factories/internal/metadata/iterate_metadata_array.ts +25 -25
  28. package/src/factories/internal/metadata/iterate_metadata_collection.ts +130 -130
  29. package/src/factories/internal/metadata/iterate_metadata_definition.ts +30 -30
  30. package/src/factories/internal/metadata/iterate_metadata_object.ts +49 -49
  31. package/src/factories/internal/metadata/iterate_metadata_sort.ts +68 -68
  32. package/src/factories/internal/metadata/iterate_metadata_tuple.ts +24 -24
  33. package/src/factories/internal/metadata/iterate_metadata_union.ts +68 -68
  34. package/src/metadata/IMetadata.ts +27 -27
  35. package/src/metadata/IMetadataAlias.ts +12 -12
  36. package/src/metadata/IMetadataApplication.ts +7 -7
  37. package/src/metadata/IMetadataArray.ts +10 -10
  38. package/src/metadata/IMetadataCollection.ts +11 -11
  39. package/src/metadata/IMetadataDictionary.ts +14 -14
  40. package/src/metadata/IMetadataObject.ts +18 -18
  41. package/src/metadata/IMetadataProperty.ts +11 -11
  42. package/src/metadata/IMetadataTuple.ts +10 -10
  43. package/src/metadata/Metadata.ts +585 -585
  44. package/src/metadata/MetadataAlias.ts +61 -61
  45. package/src/metadata/MetadataArray.ts +52 -52
  46. package/src/metadata/MetadataObject.ts +114 -114
  47. package/src/metadata/MetadataProperty.ts +64 -64
  48. package/src/metadata/MetadataTuple.ts +53 -53
  49. package/src/programmers/ApplicationProgrammer.ts +55 -55
  50. package/src/programmers/AssertProgrammer.ts +291 -291
  51. package/src/programmers/CheckerProgrammer.ts +1182 -1182
  52. package/src/programmers/CloneProgrammer.ts +595 -595
  53. package/src/programmers/FeatureProgrammer.ts +495 -495
  54. package/src/programmers/IsProgrammer.ts +250 -250
  55. package/src/programmers/LiteralsProgrammer.ts +66 -66
  56. package/src/programmers/PruneProgrammer.ts +550 -550
  57. package/src/programmers/RandomProgrammer.ts +589 -589
  58. package/src/programmers/StringifyProgrammer.ts +990 -990
  59. package/src/programmers/ValidateProgrammer.ts +313 -313
  60. package/src/programmers/helpers/FunctionImporeter.ts +78 -78
  61. package/src/programmers/helpers/RandomJoiner.ts +173 -173
  62. package/src/programmers/helpers/UnionExplorer.ts +301 -301
  63. package/src/programmers/helpers/UnionPredicator.ts +81 -81
  64. package/src/programmers/helpers/disable_function_importer_declare.ts +26 -26
  65. package/src/programmers/internal/JSON_SCHEMA_PREFIX.ts +1 -1
  66. package/src/programmers/internal/application_array.ts +30 -64
  67. package/src/programmers/internal/application_boolean.ts +15 -15
  68. package/src/programmers/internal/application_constant.ts +26 -26
  69. package/src/programmers/internal/application_default.ts +17 -17
  70. package/src/programmers/internal/application_definition.ts +45 -45
  71. package/src/programmers/internal/application_native.ts +39 -39
  72. package/src/programmers/internal/application_number.ts +74 -74
  73. package/src/programmers/internal/application_object.ts +167 -167
  74. package/src/programmers/internal/application_schema.ts +156 -164
  75. package/src/programmers/internal/application_tuple.ts +47 -77
  76. package/src/programmers/internal/check_union_array_like.ts +329 -329
  77. package/src/programmers/internal/feature_object_entries.ts +63 -63
  78. package/src/programmers/internal/wrap_metadata_rest_tuple.ts +16 -16
  79. package/src/schemas/IJsonApplication.ts +8 -8
  80. package/src/schemas/IJsonComponents.ts +34 -45
  81. package/src/schemas/IJsonSchema.ts +134 -134
  82. package/src/transformers/CallExpressionTransformer.ts +179 -179
  83. package/src/transformers/FileTransformer.ts +47 -47
  84. package/src/transformers/features/miscellaneous/ApplicationTransformer.ts +104 -104
  85. package/src/transformers/features/miscellaneous/MetadataTransformer.ts +53 -53
  86. package/src/utils/ArrayUtil.ts +45 -45
  87. package/src/utils/RandomGenerator.ts +81 -81
@@ -1,254 +1,254 @@
1
- import ts from "typescript";
2
-
3
- import { IMetadataCollection } from "../metadata/IMetadataCollection";
4
- import { Metadata } from "../metadata/Metadata";
5
- import { MetadataAlias } from "../metadata/MetadataAlias";
6
- import { MetadataArray } from "../metadata/MetadataArray";
7
- import { MetadataObject } from "../metadata/MetadataObject";
8
- import { MetadataTuple } from "../metadata/MetadataTuple";
9
-
10
- import { Writable } from "../typings/Writable";
11
-
12
- import { MapUtil } from "../utils/MapUtil";
13
-
14
- import { CommentFactory } from "./CommentFactory";
15
- import { TypeFactory } from "./TypeFactory";
16
-
17
- export class MetadataCollection {
18
- private readonly objects_: Map<ts.Type, MetadataObject>;
19
- private readonly object_unions_: Map<string, MetadataObject[]>;
20
- private readonly aliases_: Map<ts.Type, MetadataAlias>;
21
- private readonly arrays_: Map<ts.Type, MetadataArray>;
22
- private readonly tuples_: Map<ts.Type, MetadataTuple>;
23
-
24
- private readonly names_: Map<string, Map<ts.Type, string>>;
25
- private object_index_: number;
26
- private recursive_array_index_: number;
27
- private recursive_tuple_index_: number;
28
-
29
- public constructor(
30
- private readonly options?: Partial<MetadataCollection.IOptions>,
31
- ) {
32
- this.objects_ = new Map();
33
- this.object_unions_ = new Map();
34
- this.aliases_ = new Map();
35
- this.arrays_ = new Map();
36
- this.tuples_ = new Map();
37
-
38
- this.names_ = new Map();
39
- this.object_index_ = 0;
40
- this.recursive_array_index_ = 0;
41
- this.recursive_tuple_index_ = 0;
42
- }
43
-
44
- /* -----------------------------------------------------------
45
- ACCESSORS
46
- ----------------------------------------------------------- */
47
- public aliases(): MetadataAlias[] {
48
- return [...this.aliases_.values()];
49
- }
50
-
51
- public objects(): MetadataObject[] {
52
- return [...this.objects_.values()];
53
- }
54
-
55
- public unions(): MetadataObject[][] {
56
- return [...this.object_unions_.values()];
57
- }
58
-
59
- public arrays(): MetadataArray[] {
60
- return [...this.arrays_.values()];
61
- }
62
-
63
- public tuples(): MetadataTuple[] {
64
- return [...this.tuples_.values()];
65
- }
66
-
67
- private getName(checker: ts.TypeChecker, type: ts.Type): string {
68
- const name: string = (() => {
69
- const str: string = TypeFactory.getFullName(checker)(type);
70
- return this.options?.replace ? this.options.replace(str) : str;
71
- })();
72
-
73
- const duplicates: Map<ts.Type, string> = MapUtil.take(this.names_)(
74
- name,
75
- () => new Map(),
76
- );
77
- const oldbie: string | undefined = duplicates.get(type);
78
- if (oldbie !== undefined) return oldbie;
79
-
80
- const addicted: string = duplicates.size
81
- ? `${name}.o${duplicates.size}`
82
- : name;
83
- duplicates.set(type, addicted);
84
- return addicted;
85
- }
86
-
87
- /**
88
- * @internal
89
- */
90
- public getUnionIndex(meta: Metadata): number {
91
- const key: string = meta.objects.map((obj) => obj.name).join(" | ");
92
- MapUtil.take(this.object_unions_)(key, () => meta.objects);
93
- return [...this.object_unions_.keys()].indexOf(key);
94
- }
95
-
96
- /* -----------------------------------------------------------
97
- INSTANCES
98
- ----------------------------------------------------------- */
99
- public emplace(
100
- checker: ts.TypeChecker,
101
- type: ts.Type,
102
- ): [MetadataObject, boolean] {
103
- const oldbie = this.objects_.get(type);
104
- if (oldbie !== undefined) return [oldbie, false];
105
-
106
- const $id: string = this.getName(checker, type);
107
- const obj: MetadataObject = MetadataObject.create({
108
- name: $id,
109
- properties: [],
110
- description:
111
- (type.symbol && CommentFactory.description(type.symbol)) ??
112
- undefined,
113
- jsDocTags: type.symbol?.getJsDocTags() ?? [],
114
- validated: false,
115
- index: this.object_index_++,
116
- recursive: null!,
117
- nullables: [],
118
- });
119
- this.objects_.set(type, obj);
120
- return [obj, true];
121
- }
122
-
123
- public emplaceAlias(
124
- checker: ts.TypeChecker,
125
- type: ts.Type,
126
- symbol: ts.Symbol,
127
- ): [MetadataAlias, boolean, (meta: Metadata) => void] {
128
- const oldbie = this.aliases_.get(type);
129
- if (oldbie !== undefined) return [oldbie, false, () => {}];
130
-
131
- const $id: string = this.getName(checker, type);
132
- const alias: MetadataAlias = MetadataAlias.create({
133
- name: $id,
134
- value: null!,
135
- description: CommentFactory.description(symbol) ?? null,
136
- recursive: null!,
137
- nullables: [],
138
- jsDocTags: symbol.getJsDocTags() ?? [],
139
- });
140
- this.aliases_.set(type, alias);
141
- return [alias, true, (meta) => (Writable(alias).value = meta)];
142
- }
143
-
144
- public emplaceArray(
145
- checker: ts.TypeChecker,
146
- type: ts.Type,
147
- ): [MetadataArray, boolean, (meta: Metadata) => void] {
148
- const oldbie = this.arrays_.get(type);
149
- if (oldbie !== undefined) return [oldbie, false, () => {}];
150
-
151
- const $id = this.getName(checker, type);
152
- const array: MetadataArray = MetadataArray.create({
153
- name: $id,
154
- value: null!,
155
- index: null,
156
- recursive: null!,
157
- nullables: [],
158
- });
159
- this.arrays_.set(type, array);
160
- return [array, true, (meta) => (Writable(array).value = meta)];
161
- }
162
-
163
- public emplaceTuple(
164
- checker: ts.TypeChecker,
165
- type: ts.TupleType,
166
- ): [MetadataTuple, boolean, (elements: Metadata[]) => void] {
167
- const oldbie = this.tuples_.get(type);
168
- if (oldbie !== undefined) return [oldbie, false, () => {}];
169
-
170
- const $id = this.getName(checker, type);
171
- const tuple: MetadataTuple = MetadataTuple.create({
172
- name: $id,
173
- elements: null!,
174
- index: null,
175
- recursive: null!,
176
- nullables: [],
177
- });
178
- this.tuples_.set(type, tuple);
179
- return [
180
- tuple,
181
- true,
182
- (elements) => (Writable(tuple).elements = elements),
183
- ];
184
- }
185
-
186
- /**
187
- * @internal
188
- */
189
- public setObjectRecursive(obj: MetadataObject, recursive: boolean): void {
190
- Writable(obj).recursive = recursive;
191
- }
192
-
193
- /**
194
- * @internal
195
- */
196
- public setAliasRecursive(alias: MetadataAlias, recursive: boolean): void {
197
- Writable(alias).recursive = recursive;
198
- }
199
-
200
- /**
201
- * @internal
202
- */
203
- public setArrayRecursive(array: MetadataArray, recursive: boolean): void {
204
- Writable(array).recursive = recursive;
205
- if (recursive) Writable(array).index = this.recursive_array_index_++;
206
- }
207
-
208
- public setTupleRecursive(tuple: MetadataTuple, recursive: boolean): void {
209
- Writable(tuple).recursive = recursive;
210
- if (recursive) Writable(tuple).index = this.recursive_tuple_index_++;
211
- }
212
-
213
- public toJSON(): IMetadataCollection {
214
- return {
215
- objects: this.objects().map((o) => o.toJSON()),
216
- aliases: this.aliases().map((d) => d.toJSON()),
217
- arrays: [...this.arrays_.values()].map((a) => a.toJSON()),
218
- tuples: [...this.tuples_.values()].map((t) => t.toJSON()),
219
- };
220
- }
221
- }
222
- export namespace MetadataCollection {
223
- export interface IOptions {
224
- replace?(str: string): string;
225
- }
226
-
227
- export const replace = (str: string): string => {
228
- for (const [before, after] of REPLACERS)
229
- str = str.split(before).join(after);
230
- return str;
231
- };
232
-
233
- export const escape = (str: string): string => {
234
- for (const [before, after] of REPLACERS)
235
- if (after !== "") str = str.split(after).join(before);
236
- return str;
237
- };
238
- }
239
- const REPLACERS: [string, string][] = [
240
- ["$", "_dollar_"],
241
- ["&", "_and_"],
242
- ["|", "_or_"],
243
- ["{", "_blt_"],
244
- ["}", "_bgt_"],
245
- ["<", "_lt_"],
246
- [">", "_gt_"],
247
- ["[", "_alt_"],
248
- ["]", "_agt_"],
249
- [",", "_comma_"],
250
- ["`", "_backquote_"],
251
- ["'", "_singlequote_"],
252
- ['"', "_doublequote_"],
253
- [" ", "_space_"],
254
- ];
1
+ import ts from "typescript";
2
+
3
+ import { IMetadataCollection } from "../metadata/IMetadataCollection";
4
+ import { Metadata } from "../metadata/Metadata";
5
+ import { MetadataAlias } from "../metadata/MetadataAlias";
6
+ import { MetadataArray } from "../metadata/MetadataArray";
7
+ import { MetadataObject } from "../metadata/MetadataObject";
8
+ import { MetadataTuple } from "../metadata/MetadataTuple";
9
+
10
+ import { Writable } from "../typings/Writable";
11
+
12
+ import { MapUtil } from "../utils/MapUtil";
13
+
14
+ import { CommentFactory } from "./CommentFactory";
15
+ import { TypeFactory } from "./TypeFactory";
16
+
17
+ export class MetadataCollection {
18
+ private readonly objects_: Map<ts.Type, MetadataObject>;
19
+ private readonly object_unions_: Map<string, MetadataObject[]>;
20
+ private readonly aliases_: Map<ts.Type, MetadataAlias>;
21
+ private readonly arrays_: Map<ts.Type, MetadataArray>;
22
+ private readonly tuples_: Map<ts.Type, MetadataTuple>;
23
+
24
+ private readonly names_: Map<string, Map<ts.Type, string>>;
25
+ private object_index_: number;
26
+ private recursive_array_index_: number;
27
+ private recursive_tuple_index_: number;
28
+
29
+ public constructor(
30
+ private readonly options?: Partial<MetadataCollection.IOptions>,
31
+ ) {
32
+ this.objects_ = new Map();
33
+ this.object_unions_ = new Map();
34
+ this.aliases_ = new Map();
35
+ this.arrays_ = new Map();
36
+ this.tuples_ = new Map();
37
+
38
+ this.names_ = new Map();
39
+ this.object_index_ = 0;
40
+ this.recursive_array_index_ = 0;
41
+ this.recursive_tuple_index_ = 0;
42
+ }
43
+
44
+ /* -----------------------------------------------------------
45
+ ACCESSORS
46
+ ----------------------------------------------------------- */
47
+ public aliases(): MetadataAlias[] {
48
+ return [...this.aliases_.values()];
49
+ }
50
+
51
+ public objects(): MetadataObject[] {
52
+ return [...this.objects_.values()];
53
+ }
54
+
55
+ public unions(): MetadataObject[][] {
56
+ return [...this.object_unions_.values()];
57
+ }
58
+
59
+ public arrays(): MetadataArray[] {
60
+ return [...this.arrays_.values()];
61
+ }
62
+
63
+ public tuples(): MetadataTuple[] {
64
+ return [...this.tuples_.values()];
65
+ }
66
+
67
+ private getName(checker: ts.TypeChecker, type: ts.Type): string {
68
+ const name: string = (() => {
69
+ const str: string = TypeFactory.getFullName(checker)(type);
70
+ return this.options?.replace ? this.options.replace(str) : str;
71
+ })();
72
+
73
+ const duplicates: Map<ts.Type, string> = MapUtil.take(this.names_)(
74
+ name,
75
+ () => new Map(),
76
+ );
77
+ const oldbie: string | undefined = duplicates.get(type);
78
+ if (oldbie !== undefined) return oldbie;
79
+
80
+ const addicted: string = duplicates.size
81
+ ? `${name}.o${duplicates.size}`
82
+ : name;
83
+ duplicates.set(type, addicted);
84
+ return addicted;
85
+ }
86
+
87
+ /**
88
+ * @internal
89
+ */
90
+ public getUnionIndex(meta: Metadata): number {
91
+ const key: string = meta.objects.map((obj) => obj.name).join(" | ");
92
+ MapUtil.take(this.object_unions_)(key, () => meta.objects);
93
+ return [...this.object_unions_.keys()].indexOf(key);
94
+ }
95
+
96
+ /* -----------------------------------------------------------
97
+ INSTANCES
98
+ ----------------------------------------------------------- */
99
+ public emplace(
100
+ checker: ts.TypeChecker,
101
+ type: ts.Type,
102
+ ): [MetadataObject, boolean] {
103
+ const oldbie = this.objects_.get(type);
104
+ if (oldbie !== undefined) return [oldbie, false];
105
+
106
+ const $id: string = this.getName(checker, type);
107
+ const obj: MetadataObject = MetadataObject.create({
108
+ name: $id,
109
+ properties: [],
110
+ description:
111
+ (type.symbol && CommentFactory.description(type.symbol)) ??
112
+ undefined,
113
+ jsDocTags: type.symbol?.getJsDocTags() ?? [],
114
+ validated: false,
115
+ index: this.object_index_++,
116
+ recursive: null!,
117
+ nullables: [],
118
+ });
119
+ this.objects_.set(type, obj);
120
+ return [obj, true];
121
+ }
122
+
123
+ public emplaceAlias(
124
+ checker: ts.TypeChecker,
125
+ type: ts.Type,
126
+ symbol: ts.Symbol,
127
+ ): [MetadataAlias, boolean, (meta: Metadata) => void] {
128
+ const oldbie = this.aliases_.get(type);
129
+ if (oldbie !== undefined) return [oldbie, false, () => {}];
130
+
131
+ const $id: string = this.getName(checker, type);
132
+ const alias: MetadataAlias = MetadataAlias.create({
133
+ name: $id,
134
+ value: null!,
135
+ description: CommentFactory.description(symbol) ?? null,
136
+ recursive: null!,
137
+ nullables: [],
138
+ jsDocTags: symbol.getJsDocTags() ?? [],
139
+ });
140
+ this.aliases_.set(type, alias);
141
+ return [alias, true, (meta) => (Writable(alias).value = meta)];
142
+ }
143
+
144
+ public emplaceArray(
145
+ checker: ts.TypeChecker,
146
+ type: ts.Type,
147
+ ): [MetadataArray, boolean, (meta: Metadata) => void] {
148
+ const oldbie = this.arrays_.get(type);
149
+ if (oldbie !== undefined) return [oldbie, false, () => {}];
150
+
151
+ const $id = this.getName(checker, type);
152
+ const array: MetadataArray = MetadataArray.create({
153
+ name: $id,
154
+ value: null!,
155
+ index: null,
156
+ recursive: null!,
157
+ nullables: [],
158
+ });
159
+ this.arrays_.set(type, array);
160
+ return [array, true, (meta) => (Writable(array).value = meta)];
161
+ }
162
+
163
+ public emplaceTuple(
164
+ checker: ts.TypeChecker,
165
+ type: ts.TupleType,
166
+ ): [MetadataTuple, boolean, (elements: Metadata[]) => void] {
167
+ const oldbie = this.tuples_.get(type);
168
+ if (oldbie !== undefined) return [oldbie, false, () => {}];
169
+
170
+ const $id = this.getName(checker, type);
171
+ const tuple: MetadataTuple = MetadataTuple.create({
172
+ name: $id,
173
+ elements: null!,
174
+ index: null,
175
+ recursive: null!,
176
+ nullables: [],
177
+ });
178
+ this.tuples_.set(type, tuple);
179
+ return [
180
+ tuple,
181
+ true,
182
+ (elements) => (Writable(tuple).elements = elements),
183
+ ];
184
+ }
185
+
186
+ /**
187
+ * @internal
188
+ */
189
+ public setObjectRecursive(obj: MetadataObject, recursive: boolean): void {
190
+ Writable(obj).recursive = recursive;
191
+ }
192
+
193
+ /**
194
+ * @internal
195
+ */
196
+ public setAliasRecursive(alias: MetadataAlias, recursive: boolean): void {
197
+ Writable(alias).recursive = recursive;
198
+ }
199
+
200
+ /**
201
+ * @internal
202
+ */
203
+ public setArrayRecursive(array: MetadataArray, recursive: boolean): void {
204
+ Writable(array).recursive = recursive;
205
+ if (recursive) Writable(array).index = this.recursive_array_index_++;
206
+ }
207
+
208
+ public setTupleRecursive(tuple: MetadataTuple, recursive: boolean): void {
209
+ Writable(tuple).recursive = recursive;
210
+ if (recursive) Writable(tuple).index = this.recursive_tuple_index_++;
211
+ }
212
+
213
+ public toJSON(): IMetadataCollection {
214
+ return {
215
+ objects: this.objects().map((o) => o.toJSON()),
216
+ aliases: this.aliases().map((d) => d.toJSON()),
217
+ arrays: [...this.arrays_.values()].map((a) => a.toJSON()),
218
+ tuples: [...this.tuples_.values()].map((t) => t.toJSON()),
219
+ };
220
+ }
221
+ }
222
+ export namespace MetadataCollection {
223
+ export interface IOptions {
224
+ replace?(str: string): string;
225
+ }
226
+
227
+ export const replace = (str: string): string => {
228
+ for (const [before, after] of REPLACERS)
229
+ str = str.split(before).join(after);
230
+ return str;
231
+ };
232
+
233
+ export const escape = (str: string): string => {
234
+ for (const [before, after] of REPLACERS)
235
+ if (after !== "") str = str.split(after).join(before);
236
+ return str;
237
+ };
238
+ }
239
+ const REPLACERS: [string, string][] = [
240
+ ["$", "_dollar_"],
241
+ ["&", "_and_"],
242
+ ["|", "_or_"],
243
+ ["{", "_blt_"],
244
+ ["}", "_bgt_"],
245
+ ["<", "_lt_"],
246
+ [">", "_gt_"],
247
+ ["[", "_alt_"],
248
+ ["]", "_agt_"],
249
+ [",", "_comma_"],
250
+ ["`", "_backquote_"],
251
+ ["'", "_singlequote_"],
252
+ ['"', "_doublequote_"],
253
+ [" ", "_space_"],
254
+ ];
@@ -1,40 +1,40 @@
1
- import ts from "typescript";
2
-
3
- import { Metadata } from "../metadata/Metadata";
4
- import { explore_metadata } from "./internal/metadata/explore_metadata";
5
- import { iterate_metadata_collection } from "./internal/metadata/iterate_metadata_collection";
6
- import { iterate_metadata_sort } from "./internal/metadata/iterate_metadata_sort";
7
-
8
- import { MetadataCollection } from "./MetadataCollection";
9
-
10
- export namespace MetadataFactory {
11
- export interface IOptions {
12
- resolve: boolean;
13
- constant: boolean;
14
- absorb: boolean;
15
- validate?: (meta: Metadata) => void;
16
- }
17
-
18
- export const analyze =
19
- (checker: ts.TypeChecker) =>
20
- (options: IOptions) =>
21
- (collection: MetadataCollection) =>
22
- (type: ts.Type | null): Metadata => {
23
- const meta: Metadata = explore_metadata(checker)(options)(
24
- collection,
25
- )(type, false);
26
- iterate_metadata_collection(collection);
27
- iterate_metadata_sort(collection)(meta);
28
- return meta;
29
- };
30
-
31
- /**
32
- * @deprecated Use `analyze` function instead
33
- */
34
- export const generate = (
35
- checker: ts.TypeChecker,
36
- collection: MetadataCollection,
37
- type: ts.Type,
38
- options: IOptions,
39
- ) => analyze(checker)(options)(collection)(type);
40
- }
1
+ import ts from "typescript";
2
+
3
+ import { Metadata } from "../metadata/Metadata";
4
+ import { explore_metadata } from "./internal/metadata/explore_metadata";
5
+ import { iterate_metadata_collection } from "./internal/metadata/iterate_metadata_collection";
6
+ import { iterate_metadata_sort } from "./internal/metadata/iterate_metadata_sort";
7
+
8
+ import { MetadataCollection } from "./MetadataCollection";
9
+
10
+ export namespace MetadataFactory {
11
+ export interface IOptions {
12
+ resolve: boolean;
13
+ constant: boolean;
14
+ absorb: boolean;
15
+ validate?: (meta: Metadata) => void;
16
+ }
17
+
18
+ export const analyze =
19
+ (checker: ts.TypeChecker) =>
20
+ (options: IOptions) =>
21
+ (collection: MetadataCollection) =>
22
+ (type: ts.Type | null): Metadata => {
23
+ const meta: Metadata = explore_metadata(checker)(options)(
24
+ collection,
25
+ )(type, false);
26
+ iterate_metadata_collection(collection);
27
+ iterate_metadata_sort(collection)(meta);
28
+ return meta;
29
+ };
30
+
31
+ /**
32
+ * @deprecated Use `analyze` function instead
33
+ */
34
+ export const generate = (
35
+ checker: ts.TypeChecker,
36
+ collection: MetadataCollection,
37
+ type: ts.Type,
38
+ options: IOptions,
39
+ ) => analyze(checker)(options)(collection)(type);
40
+ }