typia 7.0.0-dev.20240923 → 7.0.0-dev.20240928

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 (57) hide show
  1. package/lib/index.mjs +1 -0
  2. package/lib/index.mjs.map +1 -1
  3. package/lib/programmers/AssertProgrammer.d.ts +1 -1
  4. package/lib/programmers/AssertProgrammer.js +169 -127
  5. package/lib/programmers/AssertProgrammer.js.map +1 -1
  6. package/lib/programmers/CheckerProgrammer.d.ts +70 -15
  7. package/lib/programmers/CheckerProgrammer.js +998 -638
  8. package/lib/programmers/CheckerProgrammer.js.map +1 -1
  9. package/lib/programmers/FeatureProgrammer.d.ts +7 -3
  10. package/lib/programmers/FeatureProgrammer.js +17 -17
  11. package/lib/programmers/FeatureProgrammer.js.map +1 -1
  12. package/lib/programmers/IsProgrammer.d.ts +25 -4
  13. package/lib/programmers/IsProgrammer.js +54 -39
  14. package/lib/programmers/IsProgrammer.js.map +1 -1
  15. package/lib/programmers/ValidateProgrammer.js +110 -97
  16. package/lib/programmers/ValidateProgrammer.js.map +1 -1
  17. package/lib/programmers/helpers/UnionExplorer.d.ts +1 -1
  18. package/lib/programmers/json/JsonStringifyProgrammer.js +71 -38
  19. package/lib/programmers/json/JsonStringifyProgrammer.js.map +1 -1
  20. package/lib/programmers/llm/LlmApplicationProgrammer.js +16 -2
  21. package/lib/programmers/llm/LlmApplicationProgrammer.js.map +1 -1
  22. package/lib/programmers/misc/MiscCloneProgrammer.js +504 -406
  23. package/lib/programmers/misc/MiscCloneProgrammer.js.map +1 -1
  24. package/lib/programmers/misc/MiscLiteralsProgrammer.js +3 -3
  25. package/lib/programmers/misc/MiscLiteralsProgrammer.js.map +1 -1
  26. package/lib/programmers/misc/MiscPruneProgrammer.js +365 -301
  27. package/lib/programmers/misc/MiscPruneProgrammer.js.map +1 -1
  28. package/lib/programmers/notations/NotationGeneralProgrammer.js +62 -15
  29. package/lib/programmers/notations/NotationGeneralProgrammer.js.map +1 -1
  30. package/lib/programmers/protobuf/ProtobufEncodeProgrammer.js +17 -3
  31. package/lib/programmers/protobuf/ProtobufEncodeProgrammer.js.map +1 -1
  32. package/lib/tags/Example.d.ts +14 -0
  33. package/lib/tags/Example.js +3 -0
  34. package/lib/tags/Example.js.map +1 -0
  35. package/lib/tags/Examples.d.ts +10 -0
  36. package/lib/tags/Examples.js +3 -0
  37. package/lib/tags/Examples.js.map +1 -0
  38. package/lib/tags/index.d.ts +2 -0
  39. package/lib/tags/index.js +2 -0
  40. package/lib/tags/index.js.map +1 -1
  41. package/package.json +2 -2
  42. package/src/programmers/AssertProgrammer.ts +185 -143
  43. package/src/programmers/CheckerProgrammer.ts +1380 -998
  44. package/src/programmers/FeatureProgrammer.ts +40 -34
  45. package/src/programmers/IsProgrammer.ts +94 -66
  46. package/src/programmers/ValidateProgrammer.ts +149 -137
  47. package/src/programmers/helpers/UnionExplorer.ts +1 -1
  48. package/src/programmers/json/JsonStringifyProgrammer.ts +60 -38
  49. package/src/programmers/llm/LlmApplicationProgrammer.ts +51 -32
  50. package/src/programmers/misc/MiscCloneProgrammer.ts +775 -600
  51. package/src/programmers/misc/MiscLiteralsProgrammer.ts +4 -4
  52. package/src/programmers/misc/MiscPruneProgrammer.ts +532 -415
  53. package/src/programmers/notations/NotationGeneralProgrammer.ts +64 -26
  54. package/src/programmers/protobuf/ProtobufEncodeProgrammer.ts +16 -9
  55. package/src/tags/Example.ts +17 -0
  56. package/src/tags/Examples.ts +16 -0
  57. package/src/tags/index.ts +20 -18
@@ -47,10 +47,14 @@ var wrap_metadata_rest_tuple_1 = require("../internal/wrap_metadata_rest_tuple")
47
47
  var MiscCloneProgrammer;
48
48
  (function (MiscCloneProgrammer) {
49
49
  MiscCloneProgrammer.decompose = function (props) {
50
- var config = configure(props.context)(props.importer);
50
+ var config = configure(props);
51
51
  if (props.validated === false)
52
52
  config.addition = function (collection) {
53
- return IsProgrammer_1.IsProgrammer.write_function_statements(props.context)(props.importer)(collection);
53
+ return IsProgrammer_1.IsProgrammer.write_function_statements({
54
+ context: props.context,
55
+ importer: props.importer,
56
+ collection: collection,
57
+ });
54
58
  };
55
59
  var composed = FeatureProgrammer_1.FeatureProgrammer.compose(__assign(__assign({}, props), { config: config }));
56
60
  return {
@@ -68,445 +72,543 @@ var MiscCloneProgrammer;
68
72
  result: result,
69
73
  });
70
74
  };
71
- var write_array_functions = function (config) {
72
- return function (importer) {
73
- return function (collection) {
74
- return collection
75
- .arrays()
76
- .filter(function (a) { return a.recursive; })
77
- .map(function (type, i) {
78
- return StatementFactory_1.StatementFactory.constant("".concat(config.prefix, "a").concat(i), typescript_1.default.factory.createArrowFunction(undefined, undefined, FeatureProgrammer_1.FeatureProgrammer.parameterDeclarations(config)(TypeFactory_1.TypeFactory.keyword("any"))(typescript_1.default.factory.createIdentifier("input")), TypeFactory_1.TypeFactory.keyword("any"), undefined, decode_array_inline(config)(importer)(typescript_1.default.factory.createIdentifier("input"), MetadataArray_1.MetadataArray.create({
79
- type: type,
80
- tags: [],
81
- }), {
82
- tracable: config.trace,
83
- source: "function",
84
- from: "array",
85
- postfix: "",
86
- })));
87
- });
88
- };
89
- };
75
+ var write_array_functions = function (props) {
76
+ return props.collection
77
+ .arrays()
78
+ .filter(function (a) { return a.recursive; })
79
+ .map(function (type, i) {
80
+ return StatementFactory_1.StatementFactory.constant("".concat(props.config.prefix, "a").concat(i), typescript_1.default.factory.createArrowFunction(undefined, undefined, FeatureProgrammer_1.FeatureProgrammer.parameterDeclarations(props.config)(TypeFactory_1.TypeFactory.keyword("any"))(typescript_1.default.factory.createIdentifier("input")), TypeFactory_1.TypeFactory.keyword("any"), undefined, decode_array_inline({
81
+ config: props.config,
82
+ importer: props.importer,
83
+ input: typescript_1.default.factory.createIdentifier("input"),
84
+ array: MetadataArray_1.MetadataArray.create({
85
+ type: type,
86
+ tags: [],
87
+ }),
88
+ explore: {
89
+ tracable: props.config.trace,
90
+ source: "function",
91
+ from: "array",
92
+ postfix: "",
93
+ },
94
+ })));
95
+ });
90
96
  };
91
- var write_tuple_functions = function (project) {
92
- return function (config) {
93
- return function (importer) {
94
- return function (collection) {
95
- return collection
96
- .tuples()
97
- .filter(function (t) { return t.recursive; })
98
- .map(function (tuple, i) {
99
- return StatementFactory_1.StatementFactory.constant("".concat(config.prefix, "t").concat(i), typescript_1.default.factory.createArrowFunction(undefined, undefined, FeatureProgrammer_1.FeatureProgrammer.parameterDeclarations(config)(TypeFactory_1.TypeFactory.keyword("any"))(typescript_1.default.factory.createIdentifier("input")), TypeFactory_1.TypeFactory.keyword("any"), undefined, decode_tuple_inline(project)(config)(importer)(typescript_1.default.factory.createIdentifier("input"), tuple, {
100
- tracable: config.trace,
101
- source: "function",
102
- from: "array",
103
- postfix: "",
104
- })));
105
- });
106
- };
107
- };
108
- };
97
+ var write_tuple_functions = function (props) {
98
+ return props.collection
99
+ .tuples()
100
+ .filter(function (t) { return t.recursive; })
101
+ .map(function (tuple, i) {
102
+ return StatementFactory_1.StatementFactory.constant("".concat(props.config.prefix, "t").concat(i), typescript_1.default.factory.createArrowFunction(undefined, undefined, FeatureProgrammer_1.FeatureProgrammer.parameterDeclarations(props.config)(TypeFactory_1.TypeFactory.keyword("any"))(typescript_1.default.factory.createIdentifier("input")), TypeFactory_1.TypeFactory.keyword("any"), undefined, decode_tuple_inline({
103
+ config: props.config,
104
+ context: props.context,
105
+ importer: props.importer,
106
+ input: typescript_1.default.factory.createIdentifier("input"),
107
+ tuple: tuple,
108
+ explore: {
109
+ tracable: props.config.trace,
110
+ source: "function",
111
+ from: "array",
112
+ postfix: "",
113
+ },
114
+ })));
115
+ });
109
116
  };
110
117
  /* -----------------------------------------------------------
111
118
  DECODERS
112
119
  ----------------------------------------------------------- */
113
- var decode = function (project) {
114
- return function (config) {
115
- return function (importer) {
116
- return function (input, meta, explore) {
117
- var e_1, _a, e_2, _b, e_3, _c;
118
- // ANY TYPE
119
- if (meta.any ||
120
- meta.arrays.some(function (a) { return a.type.value.any; }) ||
121
- meta.tuples.some(function (t) {
122
- return !!t.type.elements.length && t.type.elements.every(function (e) { return e.any; });
123
- }))
124
- return typescript_1.default.factory.createCallExpression(importer.use("any"), undefined, [
125
- input,
126
- ]);
127
- var unions = [];
128
- //----
129
- // LIST UP UNION TYPES
130
- //----
131
- // FUNCTIONAL
132
- if (meta.functions.length)
133
- unions.push({
134
- type: "functional",
135
- is: function () {
136
- return typescript_1.default.factory.createStrictEquality(typescript_1.default.factory.createStringLiteral("function"), typescript_1.default.factory.createTypeOfExpression(input));
137
- },
138
- value: function () { return typescript_1.default.factory.createIdentifier("undefined"); },
139
- });
140
- var _loop_1 = function (tuple) {
141
- unions.push({
142
- type: "tuple",
143
- is: function () {
144
- return IsProgrammer_1.IsProgrammer.decode(project)(importer)(input, (function () {
145
- var partial = Metadata_1.Metadata.initialize();
146
- partial.tuples.push(tuple);
147
- return partial;
148
- })(), explore);
149
- },
150
- value: function () {
151
- return decode_tuple(project)(config)(importer)(input, tuple, explore);
152
- },
153
- });
154
- };
155
- try {
156
- // TUPLES
157
- for (var _d = __values(meta.tuples), _e = _d.next(); !_e.done; _e = _d.next()) {
158
- var tuple = _e.value;
159
- _loop_1(tuple);
160
- }
161
- }
162
- catch (e_1_1) { e_1 = { error: e_1_1 }; }
163
- finally {
164
- try {
165
- if (_e && !_e.done && (_a = _d.return)) _a.call(_d);
166
- }
167
- finally { if (e_1) throw e_1.error; }
168
- }
169
- // ARRAYS
170
- if (meta.arrays.length)
171
- unions.push({
172
- type: "array",
173
- is: function () { return ExpressionFactory_1.ExpressionFactory.isArray(input); },
174
- value: function () {
175
- return explore_arrays(project)(config)(importer)(input, meta.arrays, __assign(__assign({}, explore), { from: "array" }));
176
- },
177
- });
178
- // NATIVE TYPES
179
- if (meta.sets.length)
180
- unions.push({
181
- type: "set",
182
- is: function () { return ExpressionFactory_1.ExpressionFactory.isInstanceOf("Set")(input); },
183
- value: function () {
184
- return explore_sets(project)(config)(importer)(input, meta.sets, __assign(__assign({}, explore), { from: "array" }));
185
- },
186
- });
187
- if (meta.maps.length)
188
- unions.push({
189
- type: "map",
190
- is: function () { return ExpressionFactory_1.ExpressionFactory.isInstanceOf("Map")(input); },
191
- value: function () {
192
- return explore_maps(project)(config)(importer)(input, meta.maps, __assign(__assign({}, explore), { from: "array" }));
193
- },
194
- });
195
- var _loop_2 = function (native) {
196
- unions.push({
197
- type: "native",
198
- is: function () { return ExpressionFactory_1.ExpressionFactory.isInstanceOf(native)(input); },
199
- value: function () {
200
- return native === "Boolean" || native === "Number" || native === "String"
201
- ? typescript_1.default.factory.createCallExpression(IdentifierFactory_1.IdentifierFactory.access(input)("valueOf"), undefined, undefined)
202
- : decode_native(native)(input);
203
- },
204
- });
205
- };
206
- try {
207
- for (var _f = __values(meta.natives), _g = _f.next(); !_g.done; _g = _f.next()) {
208
- var native = _g.value;
209
- _loop_2(native);
210
- }
211
- }
212
- catch (e_2_1) { e_2 = { error: e_2_1 }; }
213
- finally {
214
- try {
215
- if (_g && !_g.done && (_b = _f.return)) _b.call(_f);
216
- }
217
- finally { if (e_2) throw e_2.error; }
218
- }
219
- // OBJECTS
220
- if (meta.objects.length)
221
- unions.push({
222
- type: "object",
223
- is: function () {
224
- return ExpressionFactory_1.ExpressionFactory.isObject({
225
- checkNull: true,
226
- checkArray: false,
227
- })(input);
228
- },
229
- value: function () {
230
- return explore_objects(config)(importer)(input, meta, __assign(__assign({}, explore), { from: "object" }));
231
- },
120
+ var decode = function (props) {
121
+ var e_1, _a, e_2, _b, e_3, _c;
122
+ // ANY TYPE
123
+ if (props.metadata.any ||
124
+ props.metadata.arrays.some(function (a) { return a.type.value.any; }) ||
125
+ props.metadata.tuples.some(function (t) { return !!t.type.elements.length && t.type.elements.every(function (e) { return e.any; }); }))
126
+ return typescript_1.default.factory.createCallExpression(props.importer.use("any"), undefined, [props.input]);
127
+ var unions = [];
128
+ //----
129
+ // LIST UP UNION TYPES
130
+ //----
131
+ // FUNCTIONAL
132
+ if (props.metadata.functions.length)
133
+ unions.push({
134
+ type: "functional",
135
+ is: function () {
136
+ return typescript_1.default.factory.createStrictEquality(typescript_1.default.factory.createStringLiteral("function"), typescript_1.default.factory.createTypeOfExpression(props.input));
137
+ },
138
+ value: function () { return typescript_1.default.factory.createIdentifier("undefined"); },
139
+ });
140
+ var _loop_1 = function (tuple) {
141
+ unions.push({
142
+ type: "tuple",
143
+ is: function () {
144
+ return IsProgrammer_1.IsProgrammer.decode(__assign(__assign({}, props), { metadata: (function () {
145
+ var partial = Metadata_1.Metadata.initialize();
146
+ partial.tuples.push(tuple);
147
+ return partial;
148
+ })() }));
149
+ },
150
+ value: function () {
151
+ return decode_tuple(__assign(__assign({}, props), { tuple: tuple }));
152
+ },
153
+ });
154
+ };
155
+ try {
156
+ // TUPLES
157
+ for (var _d = __values(props.metadata.tuples), _e = _d.next(); !_e.done; _e = _d.next()) {
158
+ var tuple = _e.value;
159
+ _loop_1(tuple);
160
+ }
161
+ }
162
+ catch (e_1_1) { e_1 = { error: e_1_1 }; }
163
+ finally {
164
+ try {
165
+ if (_e && !_e.done && (_a = _d.return)) _a.call(_d);
166
+ }
167
+ finally { if (e_1) throw e_1.error; }
168
+ }
169
+ // ARRAYS
170
+ if (props.metadata.arrays.length)
171
+ unions.push({
172
+ type: "array",
173
+ is: function () { return ExpressionFactory_1.ExpressionFactory.isArray(props.input); },
174
+ value: function () {
175
+ return explore_arrays(__assign(__assign({}, props), { arrays: props.metadata.arrays, explore: __assign(__assign({}, props.explore), { from: "array" }) }));
176
+ },
177
+ });
178
+ // NATIVE TYPES
179
+ if (props.metadata.sets.length)
180
+ unions.push({
181
+ type: "set",
182
+ is: function () { return ExpressionFactory_1.ExpressionFactory.isInstanceOf("Set")(props.input); },
183
+ value: function () {
184
+ return explore_sets(__assign(__assign({}, props), { sets: props.metadata.sets, explore: __assign(__assign({}, props.explore), { from: "array" }) }));
185
+ },
186
+ });
187
+ if (props.metadata.maps.length)
188
+ unions.push({
189
+ type: "map",
190
+ is: function () { return ExpressionFactory_1.ExpressionFactory.isInstanceOf("Map")(props.input); },
191
+ value: function () {
192
+ return explore_maps(__assign(__assign({}, props), { maps: props.metadata.maps, explore: __assign(__assign({}, props.explore), { from: "array" }) }));
193
+ },
194
+ });
195
+ var _loop_2 = function (native) {
196
+ unions.push({
197
+ type: "native",
198
+ is: function () { return ExpressionFactory_1.ExpressionFactory.isInstanceOf(native)(props.input); },
199
+ value: function () {
200
+ return native === "Boolean" || native === "Number" || native === "String"
201
+ ? typescript_1.default.factory.createCallExpression(IdentifierFactory_1.IdentifierFactory.access(props.input)("valueOf"), undefined, undefined)
202
+ : decode_native({
203
+ type: native,
204
+ input: props.input,
232
205
  });
233
- // COMPOSITION
234
- if (unions.length === 0)
235
- return input;
236
- else if (unions.length === 1 && meta.size() === 1) {
237
- var value = (meta.nullable || meta.isRequired() === false) && is_instance(meta)
238
- ? typescript_1.default.factory.createConditionalExpression(input, undefined, unions[0].value(), undefined, input)
239
- : unions[0].value();
240
- return typescript_1.default.factory.createAsExpression(value, TypeFactory_1.TypeFactory.keyword("any"));
241
- }
242
- else {
243
- var last = input;
244
- try {
245
- for (var _h = __values(unions.reverse()), _j = _h.next(); !_j.done; _j = _h.next()) {
246
- var u = _j.value;
247
- last = typescript_1.default.factory.createConditionalExpression(u.is(), undefined, u.value(), undefined, last);
248
- }
249
- }
250
- catch (e_3_1) { e_3 = { error: e_3_1 }; }
251
- finally {
252
- try {
253
- if (_j && !_j.done && (_c = _h.return)) _c.call(_h);
254
- }
255
- finally { if (e_3) throw e_3.error; }
256
- }
257
- return typescript_1.default.factory.createAsExpression(last, TypeFactory_1.TypeFactory.keyword("any"));
258
- }
259
- };
260
- };
206
+ },
207
+ });
261
208
  };
209
+ try {
210
+ for (var _f = __values(props.metadata.natives), _g = _f.next(); !_g.done; _g = _f.next()) {
211
+ var native = _g.value;
212
+ _loop_2(native);
213
+ }
214
+ }
215
+ catch (e_2_1) { e_2 = { error: e_2_1 }; }
216
+ finally {
217
+ try {
218
+ if (_g && !_g.done && (_b = _f.return)) _b.call(_f);
219
+ }
220
+ finally { if (e_2) throw e_2.error; }
221
+ }
222
+ // OBJECTS
223
+ if (props.metadata.objects.length)
224
+ unions.push({
225
+ type: "object",
226
+ is: function () {
227
+ return ExpressionFactory_1.ExpressionFactory.isObject({
228
+ checkNull: true,
229
+ checkArray: false,
230
+ })(props.input);
231
+ },
232
+ value: function () {
233
+ return explore_objects(__assign(__assign({}, props), { explore: __assign(__assign({}, props.explore), { from: "object" }) }));
234
+ },
235
+ });
236
+ // COMPOSITION
237
+ if (unions.length === 0)
238
+ return props.input;
239
+ else if (unions.length === 1 && props.metadata.size() === 1) {
240
+ var value = (props.metadata.nullable || props.metadata.isRequired() === false) &&
241
+ is_instance(props.metadata)
242
+ ? typescript_1.default.factory.createConditionalExpression(props.input, undefined, unions[0].value(), undefined, props.input)
243
+ : unions[0].value();
244
+ return typescript_1.default.factory.createAsExpression(value, TypeFactory_1.TypeFactory.keyword("any"));
245
+ }
246
+ else {
247
+ var last = props.input;
248
+ try {
249
+ for (var _h = __values(unions.reverse()), _j = _h.next(); !_j.done; _j = _h.next()) {
250
+ var u = _j.value;
251
+ last = typescript_1.default.factory.createConditionalExpression(u.is(), undefined, u.value(), undefined, last);
252
+ }
253
+ }
254
+ catch (e_3_1) { e_3 = { error: e_3_1 }; }
255
+ finally {
256
+ try {
257
+ if (_j && !_j.done && (_c = _h.return)) _c.call(_h);
258
+ }
259
+ finally { if (e_3) throw e_3.error; }
260
+ }
261
+ return typescript_1.default.factory.createAsExpression(last, TypeFactory_1.TypeFactory.keyword("any"));
262
+ }
262
263
  };
263
- var decode_object = function (importer) {
264
+ var decode_object = function (props) {
264
265
  return FeatureProgrammer_1.FeatureProgrammer.decode_object({
265
266
  trace: false,
266
267
  path: false,
267
268
  prefix: PREFIX,
268
- })(importer);
269
+ })(props.importer)(props.input, props.object, props.explore);
269
270
  };
270
- var decode_array = function (config) {
271
- return function (importer) {
272
- return function (input, array, explore) {
273
- return array.type.recursive
274
- ? typescript_1.default.factory.createCallExpression(typescript_1.default.factory.createIdentifier(importer.useLocal("".concat(config.prefix, "a").concat(array.type.index))), undefined, FeatureProgrammer_1.FeatureProgrammer.argumentsArray(config)(__assign(__assign({}, explore), { source: "function", from: "array" }))(input))
275
- : decode_array_inline(config)(importer)(input, array, explore);
276
- };
277
- };
271
+ var decode_array = function (props) {
272
+ return props.array.type.recursive
273
+ ? typescript_1.default.factory.createCallExpression(typescript_1.default.factory.createIdentifier(props.importer.useLocal("".concat(props.config.prefix, "a").concat(props.array.type.index))), undefined, FeatureProgrammer_1.FeatureProgrammer.argumentsArray(props.config)(__assign(__assign({}, props.explore), { source: "function", from: "array" }))(props.input))
274
+ : decode_array_inline(props);
278
275
  };
279
- var decode_array_inline = function (config) {
280
- return function (importer) {
281
- return function (input, array, explore) {
282
- return FeatureProgrammer_1.FeatureProgrammer.decode_array(config)(importer)(CloneJoiner_1.CloneJoiner.array)(input, array, explore);
283
- };
284
- };
276
+ var decode_array_inline = function (props) {
277
+ return FeatureProgrammer_1.FeatureProgrammer.decode_array(props.config)(props.importer)(CloneJoiner_1.CloneJoiner.array)(props.input, props.array, props.explore);
285
278
  };
286
- var decode_tuple = function (project) {
287
- return function (config) {
288
- return function (importer) {
289
- return function (input, tuple, explore) {
290
- return tuple.type.recursive
291
- ? typescript_1.default.factory.createCallExpression(typescript_1.default.factory.createIdentifier(importer.useLocal("".concat(config.prefix, "t").concat(tuple.type.index))), undefined, FeatureProgrammer_1.FeatureProgrammer.argumentsArray(config)(__assign(__assign({}, explore), { source: "function" }))(input))
292
- : decode_tuple_inline(project)(config)(importer)(input, tuple.type, explore);
293
- };
294
- };
295
- };
279
+ var decode_tuple = function (props) {
280
+ return props.tuple.type.recursive
281
+ ? typescript_1.default.factory.createCallExpression(typescript_1.default.factory.createIdentifier(props.importer.useLocal("".concat(props.config.prefix, "t").concat(props.tuple.type.index))), undefined, FeatureProgrammer_1.FeatureProgrammer.argumentsArray(props.config)(__assign(__assign({}, props.explore), { source: "function" }))(props.input))
282
+ : decode_tuple_inline(__assign(__assign({}, props), { tuple: props.tuple.type }));
296
283
  };
297
- var decode_tuple_inline = function (project) {
298
- return function (config) {
299
- return function (importer) {
300
- return function (input, tuple, explore) {
301
- var elements = tuple.elements
302
- .filter(function (m) { return m.rest === null; })
303
- .map(function (elem, index) {
304
- return decode(project)(config)(importer)(typescript_1.default.factory.createElementAccessExpression(input, index), elem, __assign(__assign({}, explore), { from: "array", postfix: explore.postfix.length
305
- ? "".concat((0, postfix_of_tuple_1.postfix_of_tuple)(explore.postfix), "[").concat(index, "]\"")
306
- : "\"[".concat(index, "]\"") }));
307
- });
308
- var rest = (function () {
309
- if (tuple.elements.length === 0)
310
- return null;
311
- var last = tuple.elements.at(-1);
312
- var rest = last.rest;
313
- if (rest === null)
314
- return null;
315
- return decode(project)(config)(importer)(typescript_1.default.factory.createCallExpression(IdentifierFactory_1.IdentifierFactory.access(input)("slice"), undefined, [ExpressionFactory_1.ExpressionFactory.number(tuple.elements.length - 1)]), (0, wrap_metadata_rest_tuple_1.wrap_metadata_rest_tuple)(tuple.elements.at(-1).rest), __assign(__assign({}, explore), { start: tuple.elements.length - 1 }));
316
- })();
317
- return CloneJoiner_1.CloneJoiner.tuple({
318
- elements: elements,
319
- rest: rest,
320
- });
321
- };
322
- };
323
- };
284
+ var decode_tuple_inline = function (props) {
285
+ var elements = props.tuple.elements
286
+ .filter(function (m) { return m.rest === null; })
287
+ .map(function (elem, index) {
288
+ return decode({
289
+ context: props.context,
290
+ config: props.config,
291
+ importer: props.importer,
292
+ input: typescript_1.default.factory.createElementAccessExpression(props.input, index),
293
+ metadata: elem,
294
+ explore: __assign(__assign({}, props.explore), { from: "array", postfix: props.explore.postfix.length
295
+ ? "".concat((0, postfix_of_tuple_1.postfix_of_tuple)(props.explore.postfix), "[").concat(index, "]\"")
296
+ : "\"[".concat(index, "]\"") }),
297
+ });
298
+ });
299
+ var rest = (function () {
300
+ if (props.tuple.elements.length === 0)
301
+ return null;
302
+ var last = props.tuple.elements.at(-1);
303
+ var rest = last.rest;
304
+ if (rest === null)
305
+ return null;
306
+ return decode({
307
+ context: props.context,
308
+ config: props.config,
309
+ importer: props.importer,
310
+ input: typescript_1.default.factory.createCallExpression(IdentifierFactory_1.IdentifierFactory.access(props.input)("slice"), undefined, [ExpressionFactory_1.ExpressionFactory.number(props.tuple.elements.length - 1)]),
311
+ metadata: (0, wrap_metadata_rest_tuple_1.wrap_metadata_rest_tuple)(props.tuple.elements.at(-1).rest),
312
+ explore: __assign(__assign({}, props.explore), { start: props.tuple.elements.length - 1 }),
313
+ });
314
+ })();
315
+ return CloneJoiner_1.CloneJoiner.tuple({
316
+ elements: elements,
317
+ rest: rest,
318
+ });
324
319
  };
325
320
  /* -----------------------------------------------------------
326
321
  NATIVE CLASSES
327
322
  ----------------------------------------------------------- */
328
- var decode_native = function (type) { return function (input) {
329
- return type === "Date" ||
330
- type === "Uint8Array" ||
331
- type === "Uint8ClampedArray" ||
332
- type === "Uint16Array" ||
333
- type === "Uint32Array" ||
334
- type === "BigUint64Array" ||
335
- type === "Int8Array" ||
336
- type === "Int16Array" ||
337
- type === "Int32Array" ||
338
- type === "BigInt64Array" ||
339
- type === "Float32Array" ||
340
- type === "Float64Array" ||
341
- type === "RegExp"
342
- ? decode_native_copyable(type)(input)
343
- : type === "ArrayBuffer" || type === "SharedArrayBuffer"
344
- ? decode_native_buffer(type)(input)
345
- : type === "DataView"
346
- ? decode_native_data_view(input)
347
- : typescript_1.default.factory.createCallExpression(typescript_1.default.factory.createIdentifier(type), undefined, []);
348
- }; };
349
- var decode_native_copyable = function (type) { return function (input) {
350
- return typescript_1.default.factory.createNewExpression(typescript_1.default.factory.createIdentifier(type), undefined, [input]);
351
- }; };
352
- var decode_native_buffer = function (type) { return function (input) {
323
+ var decode_native = function (props) {
324
+ return props.type === "Date" ||
325
+ props.type === "Uint8Array" ||
326
+ props.type === "Uint8ClampedArray" ||
327
+ props.type === "Uint16Array" ||
328
+ props.type === "Uint32Array" ||
329
+ props.type === "BigUint64Array" ||
330
+ props.type === "Int8Array" ||
331
+ props.type === "Int16Array" ||
332
+ props.type === "Int32Array" ||
333
+ props.type === "BigInt64Array" ||
334
+ props.type === "Float32Array" ||
335
+ props.type === "Float64Array" ||
336
+ props.type === "RegExp"
337
+ ? decode_native_copyable(props)
338
+ : props.type === "ArrayBuffer" || props.type === "SharedArrayBuffer"
339
+ ? decode_native_buffer({
340
+ type: props.type,
341
+ input: props.input,
342
+ })
343
+ : props.type === "DataView"
344
+ ? decode_native_data_view(props.input)
345
+ : typescript_1.default.factory.createCallExpression(typescript_1.default.factory.createIdentifier(props.type), undefined, []);
346
+ };
347
+ var decode_native_copyable = function (props) {
348
+ return typescript_1.default.factory.createNewExpression(typescript_1.default.factory.createIdentifier(props.type), undefined, [props.input]);
349
+ };
350
+ var decode_native_buffer = function (props) {
353
351
  return ExpressionFactory_1.ExpressionFactory.selfCall(typescript_1.default.factory.createBlock([
354
- StatementFactory_1.StatementFactory.constant("buffer", typescript_1.default.factory.createNewExpression(typescript_1.default.factory.createIdentifier(type), undefined, [IdentifierFactory_1.IdentifierFactory.access(input)("byteLength")])),
352
+ StatementFactory_1.StatementFactory.constant("buffer", typescript_1.default.factory.createNewExpression(typescript_1.default.factory.createIdentifier(props.type), undefined, [IdentifierFactory_1.IdentifierFactory.access(props.input)("byteLength")])),
355
353
  typescript_1.default.factory.createExpressionStatement(typescript_1.default.factory.createCallExpression(IdentifierFactory_1.IdentifierFactory.access(typescript_1.default.factory.createNewExpression(typescript_1.default.factory.createIdentifier("Uint8Array"), undefined, [typescript_1.default.factory.createIdentifier("buffer")]))("set"), undefined, [
356
- typescript_1.default.factory.createNewExpression(typescript_1.default.factory.createIdentifier("Uint8Array"), undefined, [input]),
354
+ typescript_1.default.factory.createNewExpression(typescript_1.default.factory.createIdentifier("Uint8Array"), undefined, [props.input]),
357
355
  ])),
358
356
  typescript_1.default.factory.createReturnStatement(typescript_1.default.factory.createIdentifier("buffer")),
359
357
  ], true));
360
- }; };
358
+ };
361
359
  var decode_native_data_view = function (input) {
362
360
  return typescript_1.default.factory.createNewExpression(typescript_1.default.factory.createIdentifier("DataView"), undefined, [IdentifierFactory_1.IdentifierFactory.access(input)("buffer")]);
363
361
  };
364
362
  /* -----------------------------------------------------------
365
363
  EXPLORERS FOR UNION TYPES
366
364
  ----------------------------------------------------------- */
367
- var explore_sets = function (project) {
368
- return function (config) {
369
- return function (importer) {
370
- return function (input, sets, explore) {
371
- return typescript_1.default.factory.createCallExpression(UnionExplorer_1.UnionExplorer.set({
372
- checker: IsProgrammer_1.IsProgrammer.decode(project)(importer),
373
- decoder: function (input, array, explore) {
374
- return typescript_1.default.factory.createNewExpression(typescript_1.default.factory.createIdentifier("Set"), [TypeFactory_1.TypeFactory.keyword("any")], [decode_array(config)(importer)(input, array, explore)]);
375
- },
376
- empty: typescript_1.default.factory.createNewExpression(typescript_1.default.factory.createIdentifier("Set"), [TypeFactory_1.TypeFactory.keyword("any")], []),
377
- success: typescript_1.default.factory.createTrue(),
378
- failure: function (input, expected) {
379
- return create_throw_error(importer)(expected)(input);
380
- },
381
- })([])(input, sets, explore), undefined, undefined);
382
- };
383
- };
384
- };
365
+ var explore_sets = function (props) {
366
+ return typescript_1.default.factory.createCallExpression(UnionExplorer_1.UnionExplorer.set({
367
+ checker: function (input, metadata, explore) {
368
+ return IsProgrammer_1.IsProgrammer.decode({
369
+ context: props.context,
370
+ importer: props.importer,
371
+ input: input,
372
+ metadata: metadata,
373
+ explore: explore,
374
+ });
375
+ },
376
+ decoder: function (input, array, explore) {
377
+ return typescript_1.default.factory.createNewExpression(typescript_1.default.factory.createIdentifier("Set"), [TypeFactory_1.TypeFactory.keyword("any")], [
378
+ decode_array({
379
+ config: props.config,
380
+ importer: props.importer,
381
+ input: input,
382
+ array: array,
383
+ explore: explore,
384
+ }),
385
+ ]);
386
+ },
387
+ empty: typescript_1.default.factory.createNewExpression(typescript_1.default.factory.createIdentifier("Set"), [TypeFactory_1.TypeFactory.keyword("any")], []),
388
+ success: typescript_1.default.factory.createTrue(),
389
+ failure: function (input, expected) {
390
+ return create_throw_error({
391
+ importer: props.importer,
392
+ expected: expected,
393
+ input: input,
394
+ });
395
+ },
396
+ })([])(props.input, props.sets, props.explore), undefined, undefined);
385
397
  };
386
- var explore_maps = function (project) {
387
- return function (config) {
388
- return function (importer) {
389
- return function (input, maps, explore) {
390
- return typescript_1.default.factory.createCallExpression(UnionExplorer_1.UnionExplorer.map({
391
- checker: function (top, entry, explore) {
392
- var func = IsProgrammer_1.IsProgrammer.decode(project)(importer);
393
- return typescript_1.default.factory.createLogicalAnd(func(typescript_1.default.factory.createElementAccessExpression(top, 0), entry[0], __assign(__assign({}, explore), { postfix: "".concat(explore.postfix, "[0]") })), func(typescript_1.default.factory.createElementAccessExpression(top, 1), entry[1], __assign(__assign({}, explore), { postfix: "".concat(explore.postfix, "[1]") })));
394
- },
395
- decoder: function (input, array, explore) {
396
- return typescript_1.default.factory.createNewExpression(typescript_1.default.factory.createIdentifier("Map"), [TypeFactory_1.TypeFactory.keyword("any"), TypeFactory_1.TypeFactory.keyword("any")], [decode_array(config)(importer)(input, array, explore)]);
397
- },
398
- empty: typescript_1.default.factory.createNewExpression(typescript_1.default.factory.createIdentifier("Map"), [TypeFactory_1.TypeFactory.keyword("any"), TypeFactory_1.TypeFactory.keyword("any")], []),
399
- success: typescript_1.default.factory.createTrue(),
400
- failure: function (input, expected) {
401
- return create_throw_error(importer)(expected)(input);
402
- },
403
- })([])(input, maps, explore), undefined, undefined);
404
- };
405
- };
406
- };
398
+ var explore_maps = function (props) {
399
+ return typescript_1.default.factory.createCallExpression(UnionExplorer_1.UnionExplorer.map({
400
+ checker: function (top, entry, explore) {
401
+ return typescript_1.default.factory.createLogicalAnd(IsProgrammer_1.IsProgrammer.decode({
402
+ context: props.context,
403
+ importer: props.importer,
404
+ input: typescript_1.default.factory.createElementAccessExpression(top, 0),
405
+ metadata: entry[0],
406
+ explore: __assign(__assign({}, explore), { postfix: "".concat(explore.postfix, "[0]") }),
407
+ }), IsProgrammer_1.IsProgrammer.decode({
408
+ context: props.context,
409
+ importer: props.importer,
410
+ input: typescript_1.default.factory.createElementAccessExpression(top, 1),
411
+ metadata: entry[1],
412
+ explore: __assign(__assign({}, explore), { postfix: "".concat(explore.postfix, "[1]") }),
413
+ }));
414
+ },
415
+ decoder: function (input, array, explore) {
416
+ return typescript_1.default.factory.createNewExpression(typescript_1.default.factory.createIdentifier("Map"), [TypeFactory_1.TypeFactory.keyword("any"), TypeFactory_1.TypeFactory.keyword("any")], [
417
+ decode_array({
418
+ config: props.config,
419
+ importer: props.importer,
420
+ input: input,
421
+ array: array,
422
+ explore: explore,
423
+ }),
424
+ ]);
425
+ },
426
+ empty: typescript_1.default.factory.createNewExpression(typescript_1.default.factory.createIdentifier("Map"), [TypeFactory_1.TypeFactory.keyword("any"), TypeFactory_1.TypeFactory.keyword("any")], []),
427
+ success: typescript_1.default.factory.createTrue(),
428
+ failure: function (input, expected) {
429
+ return create_throw_error({
430
+ importer: props.importer,
431
+ expected: expected,
432
+ input: input,
433
+ });
434
+ },
435
+ })([])(props.input, props.maps, props.explore), undefined, undefined);
407
436
  };
408
- var explore_objects = function (config) {
409
- return function (importer) {
410
- return function (input, meta, explore) {
411
- return meta.objects.length === 1
412
- ? decode_object(importer)(input, meta.objects[0], explore)
413
- : typescript_1.default.factory.createCallExpression(typescript_1.default.factory.createIdentifier(importer.useLocal("".concat(PREFIX, "u").concat(meta.union_index))), undefined, FeatureProgrammer_1.FeatureProgrammer.argumentsArray(config)(explore)(input));
414
- };
415
- };
437
+ var explore_objects = function (props) {
438
+ return props.metadata.objects.length === 1
439
+ ? decode_object(__assign(__assign({}, props), { object: props.metadata.objects[0] }))
440
+ : typescript_1.default.factory.createCallExpression(typescript_1.default.factory.createIdentifier(props.importer.useLocal("".concat(PREFIX, "u").concat(props.metadata.union_index))), undefined, FeatureProgrammer_1.FeatureProgrammer.argumentsArray(props.config)(props.explore)(props.input));
416
441
  };
417
- var explore_arrays = function (project) {
418
- return function (config) {
419
- return function (importer) {
420
- return function (input, elements, explore) {
421
- return explore_array_like_union_types(config)(importer)(UnionExplorer_1.UnionExplorer.array({
422
- checker: IsProgrammer_1.IsProgrammer.decode(project)(importer),
423
- decoder: decode_array(config)(importer),
424
- empty: typescript_1.default.factory.createIdentifier("[]"),
425
- success: typescript_1.default.factory.createTrue(),
426
- failure: function (input, expected) {
427
- return create_throw_error(importer)(expected)(input);
428
- },
429
- }))(input, elements, explore);
430
- };
431
- };
432
- };
442
+ var explore_arrays = function (props) {
443
+ return explore_array_like_union_types(__assign(__assign({}, props), { elements: props.arrays, factory: function (next) {
444
+ return UnionExplorer_1.UnionExplorer.array({
445
+ checker: function (input, metadata, explore) {
446
+ return IsProgrammer_1.IsProgrammer.decode({
447
+ context: props.context,
448
+ importer: props.importer,
449
+ input: input,
450
+ metadata: metadata,
451
+ explore: explore,
452
+ });
453
+ },
454
+ decoder: function (input, array, explore) {
455
+ return decode_array({
456
+ config: props.config,
457
+ importer: props.importer,
458
+ input: input,
459
+ array: array,
460
+ explore: explore,
461
+ });
462
+ },
463
+ empty: typescript_1.default.factory.createIdentifier("[]"),
464
+ success: typescript_1.default.factory.createTrue(),
465
+ failure: function (input, expected) {
466
+ return create_throw_error({
467
+ importer: props.importer,
468
+ expected: expected,
469
+ input: input,
470
+ });
471
+ },
472
+ })(next.parameters)(next.input, next.elements, next.explore);
473
+ } }));
433
474
  };
434
- var explore_array_like_union_types = function (config) {
435
- return function (importer) {
436
- return function (factory) {
437
- return function (input, elements, explore) {
438
- var arrow = function (parameters) {
439
- return function (explore) {
440
- return function (input) {
441
- return factory(parameters)(input, elements, explore);
442
- };
443
- };
444
- };
445
- if (elements.every(function (e) { return e.type.recursive === false; }))
446
- typescript_1.default.factory.createCallExpression(arrow([])(explore)(input), undefined, []);
447
- explore = __assign(__assign({}, explore), { source: "function", from: "array" });
448
- return typescript_1.default.factory.createCallExpression(typescript_1.default.factory.createIdentifier(importer.emplaceUnion(config.prefix, elements.map(function (e) { return e.type.name; }).join(" | "), function () {
449
- return arrow(FeatureProgrammer_1.FeatureProgrammer.parameterDeclarations(config)(TypeFactory_1.TypeFactory.keyword("any"))(typescript_1.default.factory.createIdentifier("input")))(__assign(__assign({}, explore), { postfix: "" }))(typescript_1.default.factory.createIdentifier("input"));
450
- })), undefined, FeatureProgrammer_1.FeatureProgrammer.argumentsArray(config)(explore)(input));
451
- };
452
- };
475
+ var explore_array_like_union_types = function (props) {
476
+ var arrow = function (next) {
477
+ return props.factory({
478
+ elements: props.elements,
479
+ parameters: next.parameters,
480
+ input: next.input,
481
+ explore: next.explore,
482
+ });
453
483
  };
484
+ if (props.elements.every(function (e) { return e.type.recursive === false; }))
485
+ typescript_1.default.factory.createCallExpression(arrow({
486
+ parameters: [],
487
+ explore: props.explore,
488
+ input: props.input,
489
+ }), undefined, []);
490
+ var arrayExplore = __assign(__assign({}, props.explore), { source: "function", from: "array" });
491
+ return typescript_1.default.factory.createCallExpression(typescript_1.default.factory.createIdentifier(props.importer.emplaceUnion(props.config.prefix, props.elements.map(function (e) { return e.type.name; }).join(" | "), function () {
492
+ return arrow({
493
+ parameters: FeatureProgrammer_1.FeatureProgrammer.parameterDeclarations(props.config)(TypeFactory_1.TypeFactory.keyword("any"))(typescript_1.default.factory.createIdentifier("input")),
494
+ explore: __assign(__assign({}, arrayExplore), { postfix: "" }),
495
+ input: typescript_1.default.factory.createIdentifier("input"),
496
+ });
497
+ })), undefined, FeatureProgrammer_1.FeatureProgrammer.argumentsArray(props.config)(arrayExplore)(props.input));
454
498
  };
455
499
  /* -----------------------------------------------------------
456
500
  CONFIGURATIONS
457
501
  ----------------------------------------------------------- */
458
502
  var PREFIX = "$c";
459
- var configure = function (project) {
460
- return function (importer) {
461
- var config = {
462
- types: {
463
- input: function (type, name) {
464
- return typescript_1.default.factory.createTypeReferenceNode(name !== null && name !== void 0 ? name : TypeFactory_1.TypeFactory.getFullName(project.checker)(type));
465
- },
466
- output: function (type, name) {
467
- return typescript_1.default.factory.createImportTypeNode(typescript_1.default.factory.createLiteralTypeNode(typescript_1.default.factory.createStringLiteral("typia")), undefined, typescript_1.default.factory.createIdentifier("Resolved"), [
468
- typescript_1.default.factory.createTypeReferenceNode(name !== null && name !== void 0 ? name : TypeFactory_1.TypeFactory.getFullName(project.checker)(type)),
469
- ], false);
470
- },
503
+ var configure = function (props) {
504
+ var config = {
505
+ types: {
506
+ input: function (type, name) {
507
+ return typescript_1.default.factory.createTypeReferenceNode(name !== null && name !== void 0 ? name : TypeFactory_1.TypeFactory.getFullName(props.context.checker)(type));
471
508
  },
472
- prefix: PREFIX,
473
- trace: false,
474
- path: false,
475
- initializer: initializer,
476
- decoder: function () { return decode(project)(config)(importer); },
477
- objector: {
478
- checker: function () { return IsProgrammer_1.IsProgrammer.decode(project)(importer); },
479
- decoder: function () { return decode_object(importer); },
480
- joiner: CloneJoiner_1.CloneJoiner.object,
481
- unionizer: (0, decode_union_object_1.decode_union_object)(IsProgrammer_1.IsProgrammer.decode_object(project)(importer))(decode_object(importer))(function (exp) { return exp; })(function (input, expected) {
482
- return create_throw_error(importer)(expected)(input);
483
- }),
484
- failure: function (input, expected) {
485
- return create_throw_error(importer)(expected)(input);
486
- },
509
+ output: function (type, name) {
510
+ return typescript_1.default.factory.createImportTypeNode(typescript_1.default.factory.createLiteralTypeNode(typescript_1.default.factory.createStringLiteral("typia")), undefined, typescript_1.default.factory.createIdentifier("Resolved"), [
511
+ typescript_1.default.factory.createTypeReferenceNode(name !== null && name !== void 0 ? name : TypeFactory_1.TypeFactory.getFullName(props.context.checker)(type)),
512
+ ], false);
487
513
  },
488
- generator: {
489
- arrays: function () { return write_array_functions(config)(importer); },
490
- tuples: function () { return write_tuple_functions(project)(config)(importer); },
514
+ },
515
+ prefix: PREFIX,
516
+ trace: false,
517
+ path: false,
518
+ initializer: initializer,
519
+ decoder: function () { return function (input, metadata, explore) {
520
+ return decode({
521
+ context: props.context,
522
+ importer: props.importer,
523
+ config: config,
524
+ input: input,
525
+ metadata: metadata,
526
+ explore: explore,
527
+ });
528
+ }; },
529
+ objector: {
530
+ checker: function () { return function (input, metadata, explore) {
531
+ return IsProgrammer_1.IsProgrammer.decode({
532
+ context: props.context,
533
+ importer: props.importer,
534
+ input: input,
535
+ metadata: metadata,
536
+ explore: explore,
537
+ });
538
+ }; },
539
+ decoder: function () { return function (input, object, explore) {
540
+ return decode_object({
541
+ importer: props.importer,
542
+ input: input,
543
+ object: object,
544
+ explore: explore,
545
+ });
546
+ }; },
547
+ joiner: CloneJoiner_1.CloneJoiner.object,
548
+ unionizer: (0, decode_union_object_1.decode_union_object)(function (input, object, explore) {
549
+ return IsProgrammer_1.IsProgrammer.decode_object({
550
+ context: props.context,
551
+ importer: props.importer,
552
+ input: input,
553
+ object: object,
554
+ explore: explore,
555
+ });
556
+ })(function (input, object, explore) {
557
+ return decode_object({
558
+ importer: props.importer,
559
+ input: input,
560
+ object: object,
561
+ explore: explore,
562
+ });
563
+ })(function (exp) { return exp; })(function (input, expected) {
564
+ return create_throw_error({
565
+ importer: props.importer,
566
+ expected: expected,
567
+ input: input,
568
+ });
569
+ }),
570
+ failure: function (input, expected) {
571
+ return create_throw_error({
572
+ importer: props.importer,
573
+ expected: expected,
574
+ input: input,
575
+ });
491
576
  },
492
- };
493
- return config;
577
+ },
578
+ generator: {
579
+ arrays: function () { return function (collection) {
580
+ return write_array_functions({
581
+ importer: props.importer,
582
+ config: config,
583
+ collection: collection,
584
+ });
585
+ }; },
586
+ tuples: function () { return function (collection) {
587
+ return write_tuple_functions({
588
+ context: props.context,
589
+ importer: props.importer,
590
+ config: config,
591
+ collection: collection,
592
+ });
593
+ }; },
594
+ },
494
595
  };
596
+ return config;
495
597
  };
496
- var initializer = function (project) { return function (importer) { return function (type) {
598
+ var initializer = function (context) { return function (importer) { return function (type) {
497
599
  var collection = new MetadataCollection_1.MetadataCollection();
498
600
  var result = MetadataFactory_1.MetadataFactory.analyze({
499
- checker: project.checker,
500
- transformer: project.transformer,
601
+ checker: context.checker,
602
+ transformer: context.transformer,
501
603
  options: {
502
604
  escape: false,
503
605
  constant: true,
504
606
  absorb: true,
505
- validate: function (meta) {
607
+ validate: function (metadata) {
506
608
  var output = [];
507
- if (meta.natives.some(function (n) { return n === "WeakSet"; }))
609
+ if (metadata.natives.some(function (n) { return n === "WeakSet"; }))
508
610
  output.push("unable to clone WeakSet");
509
- else if (meta.natives.some(function (n) { return n === "WeakMap"; }))
611
+ else if (metadata.natives.some(function (n) { return n === "WeakMap"; }))
510
612
  output.push("unable to clone WeakMap");
511
613
  return output;
512
614
  },
@@ -518,26 +620,22 @@ var MiscCloneProgrammer;
518
620
  throw TransformerError_1.TransformerError.from("typia.misc.".concat(importer.method))(result.errors);
519
621
  return [collection, result.data];
520
622
  }; }; };
521
- var create_throw_error = function (importer) {
522
- return function (expected) {
523
- return function (value) {
524
- return typescript_1.default.factory.createExpressionStatement(typescript_1.default.factory.createCallExpression(importer.use("throws"), [], [
525
- typescript_1.default.factory.createObjectLiteralExpression([
526
- typescript_1.default.factory.createPropertyAssignment("expected", typescript_1.default.factory.createStringLiteral(expected)),
527
- typescript_1.default.factory.createPropertyAssignment("value", value),
528
- ], true),
529
- ]));
530
- };
531
- };
623
+ var create_throw_error = function (props) {
624
+ return typescript_1.default.factory.createExpressionStatement(typescript_1.default.factory.createCallExpression(props.importer.use("throws"), [], [
625
+ typescript_1.default.factory.createObjectLiteralExpression([
626
+ typescript_1.default.factory.createPropertyAssignment("expected", typescript_1.default.factory.createStringLiteral(props.expected)),
627
+ typescript_1.default.factory.createPropertyAssignment("value", props.input),
628
+ ], true),
629
+ ]));
532
630
  };
533
- var is_instance = function (meta) {
534
- return !!meta.objects.length ||
535
- !!meta.arrays.length ||
536
- !!meta.tuples.length ||
537
- !!meta.sets.length ||
538
- !!meta.maps.length ||
539
- !!meta.natives.length ||
540
- (meta.rest !== null && is_instance(meta.rest));
631
+ var is_instance = function (metadata) {
632
+ return !!metadata.objects.length ||
633
+ !!metadata.arrays.length ||
634
+ !!metadata.tuples.length ||
635
+ !!metadata.sets.length ||
636
+ !!metadata.maps.length ||
637
+ !!metadata.natives.length ||
638
+ (metadata.rest !== null && is_instance(metadata.rest));
541
639
  };
542
640
  })(MiscCloneProgrammer || (exports.MiscCloneProgrammer = MiscCloneProgrammer = {}));
543
641
  //# sourceMappingURL=MiscCloneProgrammer.js.map