typia 3.5.0-dev.20230126 → 3.5.0-dev.20230212

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 (263) hide show
  1. package/README.md +70 -70
  2. package/lib/factories/MetadataCollection.d.ts +9 -1
  3. package/lib/factories/MetadataCollection.js +75 -2
  4. package/lib/factories/MetadataCollection.js.map +1 -1
  5. package/lib/factories/internal/metadata/iterate_metadata_native.js +0 -3
  6. package/lib/factories/internal/metadata/iterate_metadata_native.js.map +1 -1
  7. package/lib/functional/$is_between.d.ts +1 -0
  8. package/lib/functional/$is_between.js +8 -0
  9. package/lib/functional/$is_between.js.map +1 -0
  10. package/lib/metadata/IMetadataTag.d.ts +3 -7
  11. package/lib/metadata/Metadata.js +2 -2
  12. package/lib/metadata/Metadata.js.map +1 -1
  13. package/lib/module.d.ts +210 -6
  14. package/lib/module.js +88 -9
  15. package/lib/module.js.map +1 -1
  16. package/lib/programmers/AssertProgrammer.js +3 -2
  17. package/lib/programmers/AssertProgrammer.js.map +1 -1
  18. package/lib/programmers/AssertPruneProgrammer.d.ts +5 -0
  19. package/lib/programmers/AssertPruneProgrammer.js +37 -0
  20. package/lib/programmers/AssertPruneProgrammer.js.map +1 -0
  21. package/lib/programmers/CheckerProgrammer.d.ts +2 -2
  22. package/lib/programmers/CheckerProgrammer.js +21 -16
  23. package/lib/programmers/CheckerProgrammer.js.map +1 -1
  24. package/lib/programmers/FeatureProgrammer.d.ts +114 -18
  25. package/lib/programmers/FeatureProgrammer.js +4 -4
  26. package/lib/programmers/FeatureProgrammer.js.map +1 -1
  27. package/lib/programmers/IsProgrammer.d.ts +4 -3
  28. package/lib/programmers/IsProgrammer.js +72 -61
  29. package/lib/programmers/IsProgrammer.js.map +1 -1
  30. package/lib/programmers/IsPruneProgrammer.d.ts +5 -0
  31. package/lib/programmers/IsPruneProgrammer.js +37 -0
  32. package/lib/programmers/IsPruneProgrammer.js.map +1 -0
  33. package/lib/programmers/PruneProgrammer.d.ts +5 -0
  34. package/lib/programmers/PruneProgrammer.js +279 -0
  35. package/lib/programmers/PruneProgrammer.js.map +1 -0
  36. package/lib/programmers/StringifyProgrammer.js +26 -21
  37. package/lib/programmers/StringifyProgrammer.js.map +1 -1
  38. package/lib/programmers/ValidateProgrammer.js +3 -2
  39. package/lib/programmers/ValidateProgrammer.js.map +1 -1
  40. package/lib/programmers/ValidatePruneProgrammer.d.ts +5 -0
  41. package/lib/programmers/ValidatePruneProgrammer.js +37 -0
  42. package/lib/programmers/ValidatePruneProgrammer.js.map +1 -0
  43. package/lib/programmers/helpers/AtomicPredicator.d.ts +2 -0
  44. package/lib/programmers/helpers/AtomicPredicator.js +9 -1
  45. package/lib/programmers/helpers/AtomicPredicator.js.map +1 -1
  46. package/lib/programmers/helpers/IExpressionEntry.d.ts +2 -2
  47. package/lib/programmers/helpers/OptionPredicator.d.ts +1 -0
  48. package/lib/programmers/helpers/OptionPredicator.js +4 -0
  49. package/lib/programmers/helpers/OptionPredicator.js.map +1 -1
  50. package/lib/programmers/helpers/PruneJoiner.d.ts +8 -0
  51. package/lib/programmers/helpers/PruneJoiner.js +60 -0
  52. package/lib/programmers/helpers/PruneJoiner.js.map +1 -0
  53. package/lib/programmers/helpers/StringifyJoinder.d.ts +1 -1
  54. package/lib/programmers/helpers/StringifyJoinder.js +2 -4
  55. package/lib/programmers/helpers/StringifyJoinder.js.map +1 -1
  56. package/lib/programmers/internal/application_object.js +11 -11
  57. package/lib/programmers/internal/application_object.js.map +1 -1
  58. package/lib/programmers/internal/application_schema.js +21 -12
  59. package/lib/programmers/internal/application_schema.js.map +1 -1
  60. package/lib/programmers/internal/check_dynamic_properties.js +34 -11
  61. package/lib/programmers/internal/check_dynamic_properties.js.map +1 -1
  62. package/lib/programmers/internal/check_native.js +9 -1
  63. package/lib/programmers/internal/check_native.js.map +1 -1
  64. package/lib/programmers/internal/check_object.d.ts +1 -0
  65. package/lib/programmers/internal/check_object.js +13 -9
  66. package/lib/programmers/internal/check_object.js.map +1 -1
  67. package/lib/programmers/internal/check_union_array_like.d.ts +1 -1
  68. package/lib/programmers/internal/check_union_array_like.js +3 -1
  69. package/lib/programmers/internal/check_union_array_like.js.map +1 -1
  70. package/lib/programmers/internal/feature_object_entries.d.ts +2 -2
  71. package/lib/programmers/internal/feature_object_entries.js.map +1 -1
  72. package/lib/programmers/internal/prune_object_properties.d.ts +1 -0
  73. package/lib/programmers/internal/prune_object_properties.js +28 -0
  74. package/lib/programmers/internal/prune_object_properties.js.map +1 -0
  75. package/lib/programmers/internal/stringify_dynamic_properties.js.map +1 -1
  76. package/lib/programmers/internal/stringify_regular_properties.js.map +1 -1
  77. package/lib/transformers/CallExpressionTransformer.js +17 -3
  78. package/lib/transformers/CallExpressionTransformer.js.map +1 -1
  79. package/lib/transformers/ITransformOptions.d.ts +14 -0
  80. package/lib/transformers/features/miscellaneous/ApplicationTransformer.js +3 -1
  81. package/lib/transformers/features/miscellaneous/ApplicationTransformer.js.map +1 -1
  82. package/lib/transformers/features/miscellaneous/AssertPruneTransformer.d.ts +5 -0
  83. package/lib/transformers/features/miscellaneous/AssertPruneTransformer.js +23 -0
  84. package/lib/transformers/features/miscellaneous/AssertPruneTransformer.js.map +1 -0
  85. package/lib/transformers/features/miscellaneous/CreateAssertPruneTransformer.d.ts +5 -0
  86. package/lib/transformers/features/miscellaneous/CreateAssertPruneTransformer.js +17 -0
  87. package/lib/transformers/features/miscellaneous/CreateAssertPruneTransformer.js.map +1 -0
  88. package/lib/transformers/features/miscellaneous/CreateIsPruneTransformer.d.ts +5 -0
  89. package/lib/transformers/features/miscellaneous/CreateIsPruneTransformer.js +17 -0
  90. package/lib/transformers/features/miscellaneous/CreateIsPruneTransformer.js.map +1 -0
  91. package/lib/transformers/features/miscellaneous/CreatePruneTransformer.d.ts +5 -0
  92. package/lib/transformers/features/miscellaneous/CreatePruneTransformer.js +17 -0
  93. package/lib/transformers/features/miscellaneous/CreatePruneTransformer.js.map +1 -0
  94. package/lib/transformers/features/miscellaneous/CreateValidatePruneTransformer.d.ts +5 -0
  95. package/lib/transformers/features/miscellaneous/CreateValidatePruneTransformer.js +17 -0
  96. package/lib/transformers/features/miscellaneous/CreateValidatePruneTransformer.js.map +1 -0
  97. package/lib/transformers/features/miscellaneous/IsPruneTransformer.d.ts +5 -0
  98. package/lib/transformers/features/miscellaneous/IsPruneTransformer.js +23 -0
  99. package/lib/transformers/features/miscellaneous/IsPruneTransformer.js.map +1 -0
  100. package/lib/transformers/features/miscellaneous/PruneTransformer.d.ts +5 -0
  101. package/lib/transformers/features/miscellaneous/PruneTransformer.js +34 -0
  102. package/lib/transformers/features/miscellaneous/PruneTransformer.js.map +1 -0
  103. package/lib/transformers/features/miscellaneous/ValidatePruneTransformer.d.ts +5 -0
  104. package/lib/transformers/features/miscellaneous/ValidatePruneTransformer.js +23 -0
  105. package/lib/transformers/features/miscellaneous/ValidatePruneTransformer.js.map +1 -0
  106. package/package.json +5 -4
  107. package/src/factories/MetadataCollection.ts +41 -2
  108. package/src/factories/internal/metadata/iterate_metadata_native.ts +0 -5
  109. package/src/functional/$is_between.ts +7 -0
  110. package/src/metadata/IMetadataTag.ts +4 -19
  111. package/src/metadata/Metadata.ts +3 -6
  112. package/src/module.ts +366 -19
  113. package/src/programmers/AssertProgrammer.ts +3 -2
  114. package/src/programmers/AssertPruneProgrammer.ts +59 -0
  115. package/src/programmers/CheckerProgrammer.ts +21 -13
  116. package/src/programmers/FeatureProgrammer.ts +146 -21
  117. package/src/programmers/IsProgrammer.ts +107 -87
  118. package/src/programmers/IsPruneProgrammer.ts +63 -0
  119. package/src/programmers/PruneProgrammer.ts +323 -0
  120. package/src/programmers/StringifyProgrammer.ts +51 -34
  121. package/src/programmers/ValidateProgrammer.ts +3 -2
  122. package/src/programmers/ValidatePruneProgrammer.ts +73 -0
  123. package/src/programmers/helpers/AtomicPredicator.ts +17 -1
  124. package/src/programmers/helpers/IExpressionEntry.ts +4 -2
  125. package/src/programmers/helpers/OptionPredicator.ts +4 -0
  126. package/src/programmers/helpers/PruneJoiner.ts +52 -0
  127. package/src/programmers/helpers/StringifyJoinder.ts +7 -4
  128. package/src/programmers/internal/application_object.ts +5 -5
  129. package/src/programmers/internal/application_schema.ts +33 -27
  130. package/src/programmers/internal/check_dynamic_properties.ts +67 -16
  131. package/src/programmers/internal/check_native.ts +14 -2
  132. package/src/programmers/internal/check_object.ts +8 -2
  133. package/src/programmers/internal/check_union_array_like.ts +4 -2
  134. package/src/programmers/internal/feature_object_entries.ts +6 -1
  135. package/src/programmers/internal/prune_object_properties.ts +60 -0
  136. package/src/programmers/internal/stringify_dynamic_properties.ts +2 -2
  137. package/src/programmers/internal/stringify_regular_properties.ts +2 -2
  138. package/src/transformers/CallExpressionTransformer.ts +27 -16
  139. package/src/transformers/ITransformOptions.ts +15 -0
  140. package/src/transformers/features/miscellaneous/ApplicationTransformer.ts +3 -1
  141. package/src/transformers/features/miscellaneous/AssertPruneTransformer.ts +38 -0
  142. package/src/transformers/features/miscellaneous/CreateAssertPruneTransformer.ts +32 -0
  143. package/src/transformers/features/{protocols/MessageTransformer.ts → miscellaneous/CreateIsPruneTransformer.ts} +6 -6
  144. package/src/transformers/features/miscellaneous/CreatePruneTransformer.ts +31 -0
  145. package/src/transformers/features/miscellaneous/CreateValidatePruneTransformer.ts +32 -0
  146. package/src/transformers/features/miscellaneous/IsPruneTransformer.ts +38 -0
  147. package/src/transformers/features/miscellaneous/PruneTransformer.ts +46 -0
  148. package/src/transformers/features/miscellaneous/ValidatePruneTransformer.ts +38 -0
  149. package/lib/factories/ProtocolFactory.d.ts +0 -8
  150. package/lib/factories/ProtocolFactory.js +0 -112
  151. package/lib/factories/ProtocolFactory.js.map +0 -1
  152. package/lib/factories/internal/protocols/ProtocolMetadataUtil.d.ts +0 -16
  153. package/lib/factories/internal/protocols/ProtocolMetadataUtil.js +0 -156
  154. package/lib/factories/internal/protocols/ProtocolMetadataUtil.js.map +0 -1
  155. package/lib/factories/internal/protocols/emplace_protocol_object.d.ts +0 -3
  156. package/lib/factories/internal/protocols/emplace_protocol_object.js +0 -47
  157. package/lib/factories/internal/protocols/emplace_protocol_object.js.map +0 -1
  158. package/lib/factories/internal/protocols/emplace_protocol_property.d.ts +0 -4
  159. package/lib/factories/internal/protocols/emplace_protocol_property.js +0 -20
  160. package/lib/factories/internal/protocols/emplace_protocol_property.js.map +0 -1
  161. package/lib/factories/internal/protocols/iterate_protocol_atomic.d.ts +0 -3
  162. package/lib/factories/internal/protocols/iterate_protocol_atomic.js +0 -69
  163. package/lib/factories/internal/protocols/iterate_protocol_atomic.js.map +0 -1
  164. package/lib/factories/internal/protocols/iterate_protocol_constant.d.ts +0 -2
  165. package/lib/factories/internal/protocols/iterate_protocol_constant.js +0 -30
  166. package/lib/factories/internal/protocols/iterate_protocol_constant.js.map +0 -1
  167. package/lib/factories/internal/protocols/iterate_protocol_main.d.ts +0 -3
  168. package/lib/factories/internal/protocols/iterate_protocol_main.js +0 -17
  169. package/lib/factories/internal/protocols/iterate_protocol_main.js.map +0 -1
  170. package/lib/factories/internal/protocols/iterate_protocol_map.d.ts +0 -4
  171. package/lib/factories/internal/protocols/iterate_protocol_map.js +0 -75
  172. package/lib/factories/internal/protocols/iterate_protocol_map.js.map +0 -1
  173. package/lib/factories/internal/protocols/iterate_protocol_metadata.d.ts +0 -5
  174. package/lib/factories/internal/protocols/iterate_protocol_metadata.js +0 -190
  175. package/lib/factories/internal/protocols/iterate_protocol_metadata.js.map +0 -1
  176. package/lib/factories/internal/protocols/iterate_protocol_native.d.ts +0 -2
  177. package/lib/factories/internal/protocols/iterate_protocol_native.js +0 -33
  178. package/lib/factories/internal/protocols/iterate_protocol_native.js.map +0 -1
  179. package/lib/factories/internal/protocols/iterate_protocol_never.d.ts +0 -1
  180. package/lib/factories/internal/protocols/iterate_protocol_never.js +0 -6
  181. package/lib/factories/internal/protocols/iterate_protocol_never.js.map +0 -1
  182. package/lib/factories/internal/protocols/iterate_protocol_object.d.ts +0 -4
  183. package/lib/factories/internal/protocols/iterate_protocol_object.js +0 -157
  184. package/lib/factories/internal/protocols/iterate_protocol_object.js.map +0 -1
  185. package/lib/factories/internal/protocols/iterate_protocol_repeated.d.ts +0 -5
  186. package/lib/factories/internal/protocols/iterate_protocol_repeated.js +0 -25
  187. package/lib/factories/internal/protocols/iterate_protocol_repeated.js.map +0 -1
  188. package/lib/factories/internal/protocols/iterate_protocol_tuple.d.ts +0 -3
  189. package/lib/factories/internal/protocols/iterate_protocol_tuple.js +0 -46
  190. package/lib/factories/internal/protocols/iterate_protocol_tuple.js.map +0 -1
  191. package/lib/functional/$proto_bytes.d.ts +0 -2
  192. package/lib/functional/$proto_bytes.js +0 -37
  193. package/lib/functional/$proto_bytes.js.map +0 -1
  194. package/lib/functional/$proto_field.d.ts +0 -10
  195. package/lib/functional/$proto_field.js +0 -42
  196. package/lib/functional/$proto_field.js.map +0 -1
  197. package/lib/functional/$proto_float.d.ts +0 -4
  198. package/lib/functional/$proto_float.js +0 -28
  199. package/lib/functional/$proto_float.js.map +0 -1
  200. package/lib/functional/$proto_i32.d.ts +0 -2
  201. package/lib/functional/$proto_i32.js +0 -23
  202. package/lib/functional/$proto_i32.js.map +0 -1
  203. package/lib/functional/$proto_i64.d.ts +0 -2
  204. package/lib/functional/$proto_i64.js +0 -31
  205. package/lib/functional/$proto_i64.js.map +0 -1
  206. package/lib/functional/$proto_size.d.ts +0 -6
  207. package/lib/functional/$proto_size.js +0 -76
  208. package/lib/functional/$proto_size.js.map +0 -1
  209. package/lib/functional/$proto_string.d.ts +0 -2
  210. package/lib/functional/$proto_string.js +0 -34
  211. package/lib/functional/$proto_string.js.map +0 -1
  212. package/lib/functional/$varint.d.ts +0 -6
  213. package/lib/functional/$varint.js +0 -99
  214. package/lib/functional/$varint.js.map +0 -1
  215. package/lib/functional/$zigzag.d.ts +0 -4
  216. package/lib/functional/$zigzag.js +0 -34
  217. package/lib/functional/$zigzag.js.map +0 -1
  218. package/lib/messages/IProtocolMap.d.ts +0 -5
  219. package/lib/messages/IProtocolMap.js +0 -3
  220. package/lib/messages/IProtocolMap.js.map +0 -1
  221. package/lib/messages/IProtocolMessage.d.ts +0 -5
  222. package/lib/messages/IProtocolMessage.js +0 -3
  223. package/lib/messages/IProtocolMessage.js.map +0 -1
  224. package/lib/messages/IProtocolProperty.d.ts +0 -12
  225. package/lib/messages/IProtocolProperty.js +0 -3
  226. package/lib/messages/IProtocolProperty.js.map +0 -1
  227. package/lib/programmers/MessageProgrammer.d.ts +0 -5
  228. package/lib/programmers/MessageProgrammer.js +0 -141
  229. package/lib/programmers/MessageProgrammer.js.map +0 -1
  230. package/lib/transformers/features/protocols/MessageTransformer.d.ts +0 -5
  231. package/lib/transformers/features/protocols/MessageTransformer.js +0 -17
  232. package/lib/transformers/features/protocols/MessageTransformer.js.map +0 -1
  233. package/lib/utils/NameEncoder.d.ts +0 -4
  234. package/lib/utils/NameEncoder.js +0 -89
  235. package/lib/utils/NameEncoder.js.map +0 -1
  236. package/src/factories/ProtocolFactory.ts +0 -79
  237. package/src/factories/internal/protocols/ProtocolMetadataUtil.ts +0 -163
  238. package/src/factories/internal/protocols/emplace_protocol_object.ts +0 -25
  239. package/src/factories/internal/protocols/emplace_protocol_property.ts +0 -12
  240. package/src/factories/internal/protocols/iterate_protocol_atomic.ts +0 -34
  241. package/src/factories/internal/protocols/iterate_protocol_constant.ts +0 -27
  242. package/src/factories/internal/protocols/iterate_protocol_main.ts +0 -19
  243. package/src/factories/internal/protocols/iterate_protocol_map.ts +0 -58
  244. package/src/factories/internal/protocols/iterate_protocol_metadata.ts +0 -96
  245. package/src/factories/internal/protocols/iterate_protocol_native.ts +0 -34
  246. package/src/factories/internal/protocols/iterate_protocol_never.ts +0 -1
  247. package/src/factories/internal/protocols/iterate_protocol_object.ts +0 -110
  248. package/src/factories/internal/protocols/iterate_protocol_repeated.ts +0 -34
  249. package/src/factories/internal/protocols/iterate_protocol_tuple.ts +0 -29
  250. package/src/functional/$proto_bytes.ts +0 -25
  251. package/src/functional/$proto_field.ts +0 -30
  252. package/src/functional/$proto_float.ts +0 -37
  253. package/src/functional/$proto_i32.ts +0 -29
  254. package/src/functional/$proto_i64.ts +0 -37
  255. package/src/functional/$proto_size.ts +0 -82
  256. package/src/functional/$proto_string.ts +0 -24
  257. package/src/functional/$varint.ts +0 -130
  258. package/src/functional/$zigzag.ts +0 -39
  259. package/src/messages/IProtocolMap.ts +0 -5
  260. package/src/messages/IProtocolMessage.ts +0 -6
  261. package/src/messages/IProtocolProperty.ts +0 -13
  262. package/src/programmers/MessageProgrammer.ts +0 -126
  263. package/src/utils/NameEncoder.ts +0 -32
@@ -18,10 +18,6 @@ export const iterate_metadata_native =
18
18
 
19
19
  const simple = SIMPLES.get(name);
20
20
  if (simple && validator(simple)) {
21
- if (FORBIDDEN.has(name))
22
- throw new Error(
23
- `Error on typia.metadata(): typia does not allow "${name}" class type. Use "${name.toLowerCase()}" type instead.`,
24
- );
25
21
  ArrayUtil.set(meta.natives, name, (str) => str);
26
22
  return true;
27
23
  }
@@ -210,7 +206,6 @@ const GENERICS: Array<IClassInfo & { name: string }> = [
210
206
  return: "boolean",
211
207
  })),
212
208
  }));
213
- const FORBIDDEN: Set<string> = new Set(["Bolean", "Number", "String"]);
214
209
 
215
210
  interface IClassInfo {
216
211
  name?: string;
@@ -0,0 +1,7 @@
1
+ export function $is_between(
2
+ value: number,
3
+ minimum: number,
4
+ maximum: number,
5
+ ): boolean {
6
+ return minimum <= value && value <= maximum;
7
+ }
@@ -10,16 +10,14 @@ export type IMetadataTag =
10
10
  | IMetadataTag.IMinLength
11
11
  | IMetadataTag.IMaxLength
12
12
  // NUMBER
13
- | IMetadataTag.INumberType
13
+ | IMetadataTag.IType
14
14
  | IMetadataTag.IRange
15
15
  | IMetadataTag.IMinimum
16
16
  | IMetadataTag.IMaximum
17
17
  | IMetadataTag.IExclusiveMinimum
18
18
  | IMetadataTag.IExclusiveMaximum
19
19
  | IMetadataTag.IMultipleOf
20
- | IMetadataTag.IStep
21
- // BIGINT
22
- | IMetadataTag.IBigintType;
20
+ | IMetadataTag.IStep;
23
21
 
24
22
  export namespace IMetadataTag {
25
23
  /* -----------------------------------------------------------
@@ -73,17 +71,9 @@ export namespace IMetadataTag {
73
71
  /* -----------------------------------------------------------
74
72
  NUMBER
75
73
  ----------------------------------------------------------- */
76
- export interface INumberType {
74
+ export interface IType {
77
75
  kind: "type";
78
- value:
79
- | "int"
80
- | "uint"
81
- | "int32"
82
- | "uint32"
83
- | "int64"
84
- | "uint64"
85
- | "float"
86
- | "double";
76
+ value: "int" | "uint";
87
77
  }
88
78
 
89
79
  export interface IRange {
@@ -125,11 +115,6 @@ export namespace IMetadataTag {
125
115
  /* -----------------------------------------------------------
126
116
  MISCELLANEOUS
127
117
  ----------------------------------------------------------- */
128
- export interface IBigintType {
129
- kind: "type";
130
- value: "int64" | "uint64";
131
- }
132
-
133
118
  export interface ISign {
134
119
  include: boolean;
135
120
  value: number;
@@ -205,7 +205,6 @@ export class Metadata {
205
205
  public empty(): boolean {
206
206
  return this.bucket() === 0 || this.size() === 0;
207
207
  }
208
-
209
208
  public size(): number {
210
209
  return (
211
210
  (this.resolved ? 1 : 0) +
@@ -224,7 +223,6 @@ export class Metadata {
224
223
  this.maps.length
225
224
  );
226
225
  }
227
-
228
226
  public bucket(): number {
229
227
  return (
230
228
  (this.resolved ? 1 : 0) +
@@ -241,7 +239,6 @@ export class Metadata {
241
239
  (this.maps.length ? 1 : 0)
242
240
  );
243
241
  }
244
-
245
242
  public isConstant(): boolean {
246
243
  return this.bucket() === (this.constants.length ? 1 : 0);
247
244
  }
@@ -511,15 +508,15 @@ function getName(metadata: Metadata): string {
511
508
  elements.push(`Map<${map.key.getName()}, ${map.value.getName()}>`);
512
509
 
513
510
  // ARRAY
514
- if (metadata.rest !== null)
515
- elements.push(`Rest<${metadata.rest.getName()}>`);
511
+ if (metadata.rest !== null) elements.push(`...${metadata.rest.getName()}`);
516
512
  for (const tuple of metadata.tuples)
517
513
  elements.push(`[${tuple.map((elem) => elem.getName()).join(", ")}]`);
518
514
  for (const array of metadata.arrays)
519
515
  elements.push(`Array<${array.getName()}>`);
520
516
 
521
517
  // OBJECT
522
- for (const object of metadata.objects) elements.push(object.name);
518
+ for (const object of metadata.objects)
519
+ elements.push(`Resolve<${object.name}>`);
523
520
  if (metadata.resolved !== null) elements.push(metadata.resolved.getName());
524
521
 
525
522
  // RETURNS
package/src/module.ts CHANGED
@@ -1,5 +1,6 @@
1
1
  import { $every } from "./functional/$every";
2
2
  import { $guard } from "./functional/$guard";
3
+ import { $is_between } from "./functional/$is_between";
3
4
  import { $is_email } from "./functional/$is_email";
4
5
  import { $is_ipv4 } from "./functional/$is_ipv4";
5
6
  import { $is_ipv6 } from "./functional/$is_ipv6";
@@ -29,9 +30,8 @@ export * from "./IValidation";
29
30
  SINGLE FUNCTIONS
30
31
  - BASIC VALIDATORS
31
32
  - STRICT VALIDATORS
32
- - PROTOCOL BUFFER FUNCTIONS
33
33
  - JSON FUNCTIONS
34
- - MISC
34
+ - MISCELLANEOUS
35
35
  ==============================================================
36
36
  BASIC VALIDATORS
37
37
  ----------------------------------------------------------- */
@@ -97,6 +97,7 @@ export namespace assert {
97
97
  export const is_url = $is_url;
98
98
  export const is_ipv4 = $is_ipv4;
99
99
  export const is_ipv6 = $is_ipv6;
100
+ export const is_between = $is_between;
100
101
 
101
102
  export const join = $join;
102
103
  export const every = $every;
@@ -224,6 +225,7 @@ export namespace is {
224
225
  export const is_url = $is_url;
225
226
  export const is_ipv4 = $is_ipv4;
226
227
  export const is_ipv6 = $is_ipv6;
228
+ export const is_between = $is_between;
227
229
  }
228
230
 
229
231
  /**
@@ -292,6 +294,7 @@ export namespace validate {
292
294
  export const is_url = $is_url;
293
295
  export const is_ipv4 = $is_ipv4;
294
296
  export const is_ipv6 = $is_ipv6;
297
+ export const is_between = $is_between;
295
298
 
296
299
  export const join = $join;
297
300
  export const report = $report;
@@ -396,6 +399,7 @@ export namespace assertEquals {
396
399
  export const is_url = $is_url;
397
400
  export const is_ipv4 = $is_ipv4;
398
401
  export const is_ipv6 = $is_ipv6;
402
+ export const is_between = $is_between;
399
403
 
400
404
  export const join = $join;
401
405
  export const every = $every;
@@ -483,6 +487,7 @@ export namespace equals {
483
487
  export const is_url = $is_url;
484
488
  export const is_ipv4 = $is_ipv4;
485
489
  export const is_ipv6 = $is_ipv6;
490
+ export const is_between = $is_between;
486
491
  export const join = $join;
487
492
  }
488
493
 
@@ -554,6 +559,7 @@ export namespace validateEquals {
554
559
  export const is_url = $is_url;
555
560
  export const is_ipv4 = $is_ipv4;
556
561
  export const is_ipv6 = $is_ipv6;
562
+ export const is_between = $is_between;
557
563
  export const join = $join;
558
564
 
559
565
  export const report = validate.report;
@@ -589,16 +595,6 @@ export namespace validateEquals {
589
595
  };
590
596
  }
591
597
 
592
- /* -----------------------------------------------------------
593
- PROTOCOL BUFFER FUNCTIONS
594
- ----------------------------------------------------------- */
595
- export function message(): never;
596
- export function message<T>(): string;
597
-
598
- export function message(): string {
599
- halt("message");
600
- }
601
-
602
598
  /* -----------------------------------------------------------
603
599
  JSON FUNCTIONS
604
600
  ----------------------------------------------------------- */
@@ -721,6 +717,7 @@ export namespace assertParse {
721
717
  export const is_url = $is_url;
722
718
  export const is_ipv4 = $is_ipv4;
723
719
  export const is_ipv6 = $is_ipv6;
720
+ export const is_between = $is_between;
724
721
 
725
722
  export const join = $join;
726
723
  export const every = $every;
@@ -832,8 +829,8 @@ Object.assign(validateParse, validate);
832
829
  * than the native `JSON.stringify()` function. The 5x faster principle is because
833
830
  * it writes an optimized JSON conversion plan, only for the type `T`.
834
831
  *
835
- * For reference, this `typia.stringify()` does not validate the input value type. It
836
- * just believes that the input value is following the type `T`. Therefore, if you
832
+ * For reference, this `typia.stringify()` does not validate the input value type.
833
+ * It just believes that the input value is following the type `T`. Therefore, if you
837
834
  * can't ensure the input value type, it would be better to call one of below functions
838
835
  * instead.
839
836
  *
@@ -937,6 +934,7 @@ export namespace assertStringify {
937
934
  export const is_url = $is_url;
938
935
  export const is_ipv4 = $is_ipv4;
939
936
  export const is_ipv6 = $is_ipv6;
937
+ export const is_between = $is_between;
940
938
 
941
939
  export const number = $number;
942
940
  export const string = $string;
@@ -992,7 +990,7 @@ export function isStringify<T>(input: T): string | null;
992
990
  * `typia.isStringify()` is a combination function of {@link is} and
993
991
  * {@link stringify}. Therefore, it converts an input value to JSON
994
992
  * (JavaScript Object Notation) string, with type checking.
995
- *
993
+ *f
996
994
  * In such reason, when `input` value is not matched with the type `T`, it returns
997
995
  * `null` value. Otherwise, there's no problem on the `input` value, JSON string would
998
996
  * be returned.
@@ -1025,6 +1023,7 @@ export namespace isStringify {
1025
1023
  export const is_url = $is_url;
1026
1024
  export const is_ipv4 = $is_ipv4;
1027
1025
  export const is_ipv6 = $is_ipv6;
1026
+ export const is_between = $is_between;
1028
1027
 
1029
1028
  export const number = $number;
1030
1029
  export const string = $string;
@@ -1091,6 +1090,246 @@ export function validateStringify(): IValidation<string> {
1091
1090
  Object.assign(validateStringify, validate);
1092
1091
  Object.assign(validateStringify, stringify);
1093
1092
 
1093
+ /* -----------------------------------------------------------
1094
+ MISCELLANEOUS
1095
+ ----------------------------------------------------------- */
1096
+ /**
1097
+ * @internal
1098
+ */
1099
+ export function metadata<Types extends unknown[]>(): IMetadataApplication;
1100
+
1101
+ /**
1102
+ * @internal
1103
+ */
1104
+ export function metadata(): never {
1105
+ halt("metadata");
1106
+ }
1107
+
1108
+ /**
1109
+ * Prune, erase superfluous properties.
1110
+ *
1111
+ * Remove every superfluous properties from the `input` object, even including nested
1112
+ * objects. Note that, as every superfluous properties would be deleted, you never can
1113
+ * read those superfluous properties after calling this `prune()` function.
1114
+ *
1115
+ * For reference, this `typia.prune()` function does not validate the input value type.
1116
+ * It just believes that the input value is following the type `T`. Therefore, if you
1117
+ * can't ensure the input value type, it would better to call one of below functions
1118
+ * instead.
1119
+ *
1120
+ * - {@link assertPrune}
1121
+ * - {@link isPrune}
1122
+ * - {@link validatePrune}
1123
+ *
1124
+ * @template T Type of the input value
1125
+ * @param input Target instance to prune
1126
+ *
1127
+ * @author Jeongho Nam - https://github.com/samchon
1128
+ */
1129
+ export function prune<T extends object>(input: T): void;
1130
+
1131
+ /**
1132
+ * @internal
1133
+ */
1134
+ export function prune(): never {
1135
+ halt("prune");
1136
+ }
1137
+
1138
+ /**
1139
+ * @internal
1140
+ */
1141
+ export namespace prune {
1142
+ export const is_uuid = $is_uuid;
1143
+ export const is_email = $is_email;
1144
+ export const is_url = $is_url;
1145
+ export const is_ipv4 = $is_ipv4;
1146
+ export const is_ipv6 = $is_ipv6;
1147
+ export const is_between = $is_between;
1148
+
1149
+ export function throws(
1150
+ props: Pick<TypeGuardError.IProps, "expected" | "value">,
1151
+ ): void {
1152
+ throw new TypeGuardError({
1153
+ ...props,
1154
+ method: "typia.prune",
1155
+ });
1156
+ }
1157
+ }
1158
+
1159
+ /**
1160
+ * Prune, erase superfluous properties, with type assertion.
1161
+ *
1162
+ * `typia.assertPrune()` is a combination function of {@link assert} and {@link prune}.
1163
+ * Therefore, it removes every superfluous properties from the `input` object including
1164
+ * nested objects, with type assertion.
1165
+ *
1166
+ * In such reason, when `input` value is not matched with the type `T`, it throws an
1167
+ * {@link TypeGuardError}. Otherwise, there's no problem on the `input` value, its
1168
+ * every superfluous properties would be removed, including nested objects.
1169
+ *
1170
+ * @template T Type of the input value
1171
+ * @param input Target instance to assert and prune
1172
+ *
1173
+ * @author Jeongho Nam - https://github.com/samchon
1174
+ */
1175
+ export function assertPrune<T>(input: T): T;
1176
+
1177
+ /**
1178
+ * Prune, erase superfluous properties, with type assertion.
1179
+ *
1180
+ * `typia.assertPrune()` is a combination function of {@link assert} and {@link prune}.
1181
+ * Therefore, it removes every superfluous properties from the `input` object including
1182
+ * nested objects, with type assertion.
1183
+ *
1184
+ * In such reason, when `input` value is not matched with the type `T`, it throws an
1185
+ * {@link TypeGuardError}. Otherwise, there's no problem on the `input` value, its
1186
+ * every superfluous properties would be removed, including nested objects.
1187
+ *
1188
+ * @template T Type of the input value
1189
+ * @param input Target instance to assert and prune
1190
+ *
1191
+ * @author Jeongho Nam - https://github.com/samchon
1192
+ */
1193
+ export function assertPrune<T>(input: unknown): T;
1194
+
1195
+ /**
1196
+ * @internal
1197
+ */
1198
+ export function assertPrune<T>(): unknown {
1199
+ halt("assertPrune");
1200
+ }
1201
+
1202
+ /**
1203
+ * @internal
1204
+ */
1205
+ export namespace assertPrune {
1206
+ export const is_uuid = $is_uuid;
1207
+ export const is_email = $is_email;
1208
+ export const is_url = $is_url;
1209
+ export const is_ipv4 = $is_ipv4;
1210
+ export const is_ipv6 = $is_ipv6;
1211
+ export const is_between = $is_between;
1212
+
1213
+ export const join = $join;
1214
+ export const every = $every;
1215
+ export const guard = $guard("typia.assertPrune");
1216
+ }
1217
+
1218
+ /**
1219
+ * Prune, erase superfluous properties, with type checking.
1220
+ *
1221
+ * `typia.assertPrune()` is a combination function of {@link is} and {@link prune}.
1222
+ * Therefore, it removes every superfluous properties from the `input` object including
1223
+ * nested objects, with type checking.
1224
+ *
1225
+ * In such reason, when `input` value is not matched with the type `T`, it returns
1226
+ * `false` value. Otherwise, there's no problem on the `input` value, it returns
1227
+ * `true` after removing every superfluous properties, including nested objects.
1228
+ *
1229
+ * @template T Type of the input value
1230
+ * @param input Target instance to check and prune
1231
+ * @returns Whether the parametric value is following the type `T` or not
1232
+ *
1233
+ * @author Jeongho Nam - https://github.com/samchon
1234
+ */
1235
+ export function isPrune<T>(input: T): input is T;
1236
+
1237
+ /**
1238
+ * Prune, erase superfluous properties, with type checking.
1239
+ *
1240
+ * `typia.assertPrune()` is a combination function of {@link is} and {@link prune}.
1241
+ * Therefore, it removes every superfluous properties from the `input` object including
1242
+ * nested objects, with type checking.
1243
+ *
1244
+ * In such reason, when `input` value is not matched with the type `T`, it returns
1245
+ * `false` value. Otherwise, there's no problem on the `input` value, it returns
1246
+ * `true` after removing every superfluous properties, including nested objects.
1247
+ *
1248
+ * @template T Type of the input value
1249
+ * @param input Target instance to check and prune
1250
+ * @returns Whether the parametric value is following the type `T` or not
1251
+ *
1252
+ * @author Jeongho Nam - https://github.com/samchon
1253
+ */
1254
+ export function isPrune<T>(input: unknown): input is T;
1255
+
1256
+ /**
1257
+ * @internal
1258
+ */
1259
+ export function isPrune(): never {
1260
+ halt("isPrune");
1261
+ }
1262
+
1263
+ /**
1264
+ * @internal
1265
+ */
1266
+ export namespace isPrune {
1267
+ export const is_uuid = $is_uuid;
1268
+ export const is_email = $is_email;
1269
+ export const is_url = $is_url;
1270
+ export const is_ipv4 = $is_ipv4;
1271
+ export const is_ipv6 = $is_ipv6;
1272
+ export const is_between = $is_between;
1273
+
1274
+ export function throws(
1275
+ props: Pick<TypeGuardError.IProps, "expected" | "value">,
1276
+ ): void {
1277
+ throw new TypeGuardError({
1278
+ ...props,
1279
+ method: "typia.prune",
1280
+ });
1281
+ }
1282
+ }
1283
+
1284
+ /**
1285
+ * Prune, erase superfluous properties, with type validation.
1286
+ *
1287
+ * `typia.validatePrune()` is a combination function of {@link validate} and {@link prune}.
1288
+ * Therefore, it removes every superfluous properties from the `input` object including
1289
+ * nested objects, with type validation.
1290
+ *
1291
+ * In such reason, when `input` value is not matched with the type `T`, it returns
1292
+ * {@link IValidation.IFailure} value with detailed error reasons. Otherwise, there's
1293
+ * no problem on the `input` value, it returns {@link IValidation.ISucess} value after
1294
+ * removing every superfluous properties, including nested objects.
1295
+ *
1296
+ * @template T Type of the input value
1297
+ * @param input Target instance to validate and prune
1298
+ * @returns Validation result
1299
+ *
1300
+ * @author Jeongho Nam - https://github.com/samchon
1301
+ */
1302
+ export function validatePrune<T>(input: T): IValidation<T>;
1303
+
1304
+ /**
1305
+ * Prune, erase superfluous properties, with type validation.
1306
+ *
1307
+ * `typia.validatePrune()` is a combination function of {@link validate} and {@link prune}.
1308
+ * Therefore, it removes every superfluous properties from the `input` object including
1309
+ * nested objects, with type validation.
1310
+ *
1311
+ * In such reason, when `input` value is not matched with the type `T`, it returns
1312
+ * {@link IValidation.IFailure} value with detailed error reasons. Otherwise, there's
1313
+ * no problem on the `input` value, it returns {@link IValidation.ISucess} value after
1314
+ * removing every superfluous properties, including nested objects.
1315
+ *
1316
+ * @template T Type of the input value
1317
+ * @param input Target instance to validate and prune
1318
+ * @returns Validation result
1319
+ *
1320
+ * @author Jeongho Nam - https://github.com/samchon
1321
+ */
1322
+ export function validatePrune<T>(input: unknown): IValidation<T>;
1323
+
1324
+ /**
1325
+ * @internal
1326
+ */
1327
+ export function validatePrune<T>(): IValidation<T> {
1328
+ halt("validatePrune");
1329
+ }
1330
+ Object.assign(validatePrune, prune);
1331
+ Object.assign(validatePrune, validate);
1332
+
1094
1333
  /* ===========================================================
1095
1334
  FACTORY FUNCTIONS
1096
1335
  - BASIC VALIDATORS
@@ -1505,7 +1744,7 @@ export function createValidateStringify(): never;
1505
1744
  *
1506
1745
  * @template T Type of the input value
1507
1746
  * @returns A reusable `validateStringify` function
1508
- *
1747
+
1509
1748
  * @author Jeongho Nam - https://github.com/samchon
1510
1749
  */
1511
1750
  export function createValidateStringify<T>(): (
@@ -1525,17 +1764,125 @@ Object.assign(createValidateStringify, validateStringify);
1525
1764
  /* -----------------------------------------------------------
1526
1765
  MISCELLANEOUS
1527
1766
  ----------------------------------------------------------- */
1767
+ /**
1768
+ * Creates a reusable {@link prune} function.
1769
+ *
1770
+ * @danger You have to specify the generic argument `T`
1771
+ * @return Nothing until specifying the generic argument `T`
1772
+ * @throws compile error
1773
+ *
1774
+ * @author Jeongho Nam - https://github.com/samchon
1775
+ */
1776
+ export function createPrune(): never;
1777
+
1778
+ /**
1779
+ * Creates a resuable {@link prune} function.
1780
+ *
1781
+ * @template T Type of the input value
1782
+ * @returns A reusable `prune` function
1783
+ *
1784
+ * @author Jeongho Nam - https://github.com/samchon
1785
+ */
1786
+ export function createPrune<T extends object>(): (input: T) => void;
1787
+
1528
1788
  /**
1529
1789
  * @internal
1530
1790
  */
1531
- export function metadata<Types extends unknown[]>(): IMetadataApplication;
1791
+ export function createPrune<T extends object>(): (input: T) => void {
1792
+ halt("createPrune");
1793
+ }
1794
+ Object.assign(createPrune, prune);
1795
+
1796
+ /**
1797
+ * Creates a reusable {@link isPrune} function.
1798
+ *
1799
+ * @danger You have to specify the generic argument `T`
1800
+ * @return Nothing until specifying the generic argument `T`
1801
+ * @throws compile error
1802
+ *
1803
+ * @author Jeongho Nam - https://github.com/samchon
1804
+ */
1805
+ export function createAssertPrune(): never;
1806
+
1807
+ /**
1808
+ * Creates a resuable {@link isPrune} function.
1809
+ *
1810
+ * @template T Type of the input value
1811
+ * @returns A reusable `isPrune` function
1812
+ *
1813
+ * @author Jeongho Nam - https://github.com/samchon
1814
+ */
1815
+ export function createAssertPrune<T extends object>(): (input: T) => T;
1532
1816
 
1533
1817
  /**
1534
1818
  * @internal
1535
1819
  */
1536
- export function metadata(): never {
1537
- halt("metadata");
1820
+ export function createAssertPrune<T extends object>(): (input: T) => T {
1821
+ halt("createAssertPrune");
1822
+ }
1823
+ Object.assign(createAssertPrune, assertPrune);
1824
+
1825
+ /**
1826
+ * Creates a reusable {@link isPrune} function.
1827
+ *
1828
+ * @danger You have to specify the generic argument `T`
1829
+ * @return Nothing until specifying the generic argument `T`
1830
+ * @throws compile error
1831
+ *
1832
+ * @author Jeongho Nam - https://github.com/samchon
1833
+ */
1834
+ export function createIsPrune(): never;
1835
+
1836
+ /**
1837
+ * Creates a resuable {@link isPrune} function.
1838
+ *
1839
+ * @template T Type of the input value
1840
+ * @returns A reusable `isPrune` function
1841
+ *
1842
+ * @author Jeongho Nam - https://github.com/samchon
1843
+ */
1844
+ export function createIsPrune<T extends object>(): (input: T) => input is T;
1845
+
1846
+ /**
1847
+ * @internal
1848
+ */
1849
+ export function createIsPrune<T extends object>(): (input: T) => input is T {
1850
+ halt("createIsPrune");
1851
+ }
1852
+ Object.assign(createIsPrune, isPrune);
1853
+
1854
+ /**
1855
+ * Creates a reusable {@link validatePrune} function.
1856
+ *
1857
+ * @danger You have to specify the generic argument `T`
1858
+ * @return Nothing until specifying the generic argument `T`
1859
+ * @throws compile error
1860
+ *
1861
+ * @author Jeongho Nam - https://github.com/samchon
1862
+ */
1863
+ export function createValidatePrune(): never;
1864
+
1865
+ /**
1866
+ * Creates a resuable {@link validatePrune} function.
1867
+ *
1868
+ * @template T Type of the input value
1869
+ * @returns A reusable `validatePrune` function
1870
+ *
1871
+ * @author Jeongho Nam - https://github.com/samchon
1872
+ */
1873
+ export function createValidatePrune<T extends object>(): (
1874
+ input: T,
1875
+ ) => IValidation<T>;
1876
+
1877
+ /**
1878
+ * @internal
1879
+ */
1880
+ export function createValidatePrune<T extends object>(): (
1881
+ input: T,
1882
+ ) => IValidation<T> {
1883
+ halt("createValidatePrune");
1538
1884
  }
1885
+ Object.assign(createValidatePrune, validatePrune);
1539
1886
 
1540
1887
  /**
1541
1888
  * @internal
@@ -284,7 +284,7 @@ export namespace AssertProgrammer {
284
284
  return IsProgrammer.CONFIG({
285
285
  object: assert_object(equals)(importer),
286
286
  numeric: true,
287
- }).combiner(explore);
287
+ })(importer).combiner(explore);
288
288
 
289
289
  const path: string = explore.postfix
290
290
  ? `path + ${explore.postfix}`
@@ -354,6 +354,7 @@ export namespace AssertProgrammer {
354
354
  check_object({
355
355
  equals,
356
356
  assert: true,
357
+ undefined: true,
357
358
  reduce: ts.factory.createLogicalAnd,
358
359
  positive: ts.factory.createTrue(),
359
360
  superfluous: (value) =>
@@ -377,7 +378,7 @@ export namespace AssertProgrammer {
377
378
  ),
378
379
  expr,
379
380
  ),
380
- });
381
+ })(importer);
381
382
 
382
383
  const joiner =
383
384
  (equals: boolean) =>