typia 6.10.2-dev.20240920 → 6.10.2

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 (432) hide show
  1. package/LICENSE +21 -21
  2. package/README.md +118 -118
  3. package/package.json +1 -1
  4. package/src/AssertionGuard.ts +1 -1
  5. package/src/CamelCase.ts +75 -75
  6. package/src/IRandomGenerator.ts +66 -66
  7. package/src/IValidation.ts +21 -21
  8. package/src/PascalCase.ts +71 -71
  9. package/src/Primitive.ts +92 -92
  10. package/src/Resolved.ts +74 -74
  11. package/src/SnakeCase.ts +126 -126
  12. package/src/TypeGuardError.ts +37 -37
  13. package/src/executable/TypiaGenerateWizard.ts +83 -83
  14. package/src/executable/TypiaPatchWizard.ts +42 -42
  15. package/src/executable/TypiaSetupWizard.ts +174 -174
  16. package/src/executable/setup/ArgumentParser.ts +43 -43
  17. package/src/executable/setup/CommandExecutor.ts +8 -8
  18. package/src/executable/setup/FileRetriever.ts +22 -22
  19. package/src/executable/setup/PackageManager.ts +86 -86
  20. package/src/executable/setup/PluginConfigurator.ts +69 -69
  21. package/src/executable/typia.ts +55 -55
  22. package/src/factories/CommentFactory.ts +79 -79
  23. package/src/factories/ExpressionFactory.ts +150 -150
  24. package/src/factories/IdentifierFactory.ts +70 -70
  25. package/src/factories/JsonMetadataFactory.ts +53 -53
  26. package/src/factories/LiteralFactory.ts +47 -47
  27. package/src/factories/MetadataCollection.ts +274 -274
  28. package/src/factories/MetadataCommentTagFactory.ts +534 -534
  29. package/src/factories/MetadataFactory.ts +314 -314
  30. package/src/factories/MetadataTypeTagFactory.ts +336 -336
  31. package/src/factories/MetadataTypeTagSchemaFactory.ts +59 -59
  32. package/src/factories/NumericRangeFactory.ts +72 -72
  33. package/src/factories/ProtobufFactory.ts +267 -267
  34. package/src/factories/StatementFactory.ts +74 -74
  35. package/src/factories/TemplateFactory.ts +56 -56
  36. package/src/factories/TypeFactory.ts +118 -118
  37. package/src/factories/ValueFactory.ts +12 -12
  38. package/src/factories/internal/metadata/MetadataHelper.ts +21 -21
  39. package/src/factories/internal/metadata/emend_metadata_atomics.ts +45 -45
  40. package/src/factories/internal/metadata/emplace_metadata_alias.ts +41 -41
  41. package/src/factories/internal/metadata/emplace_metadata_array_type.ts +42 -42
  42. package/src/factories/internal/metadata/emplace_metadata_object.ts +186 -186
  43. package/src/factories/internal/metadata/emplace_metadata_tuple.ts +57 -57
  44. package/src/factories/internal/metadata/explore_metadata.ts +28 -28
  45. package/src/factories/internal/metadata/iterate_metadata.ts +100 -100
  46. package/src/factories/internal/metadata/iterate_metadata_alias.ts +34 -34
  47. package/src/factories/internal/metadata/iterate_metadata_array.ts +63 -63
  48. package/src/factories/internal/metadata/iterate_metadata_atomic.ts +62 -62
  49. package/src/factories/internal/metadata/iterate_metadata_coalesce.ts +28 -28
  50. package/src/factories/internal/metadata/iterate_metadata_collection.ts +131 -131
  51. package/src/factories/internal/metadata/iterate_metadata_comment_tags.ts +28 -28
  52. package/src/factories/internal/metadata/iterate_metadata_constant.ts +76 -76
  53. package/src/factories/internal/metadata/iterate_metadata_escape.ts +52 -52
  54. package/src/factories/internal/metadata/iterate_metadata_function.ts +89 -89
  55. package/src/factories/internal/metadata/iterate_metadata_intersection.ts +213 -213
  56. package/src/factories/internal/metadata/iterate_metadata_map.ts +50 -50
  57. package/src/factories/internal/metadata/iterate_metadata_native.ts +220 -220
  58. package/src/factories/internal/metadata/iterate_metadata_object.ts +33 -33
  59. package/src/factories/internal/metadata/iterate_metadata_set.ts +41 -41
  60. package/src/factories/internal/metadata/iterate_metadata_sort.ts +74 -74
  61. package/src/factories/internal/metadata/iterate_metadata_template.ts +44 -44
  62. package/src/factories/internal/metadata/iterate_metadata_tuple.ts +37 -37
  63. package/src/factories/internal/metadata/iterate_metadata_union.ts +27 -27
  64. package/src/functional/$FormDataReader/$FormDataReader.ts +83 -83
  65. package/src/functional/$FormDataReader/index.ts +1 -1
  66. package/src/functional/$HeadersReader/$HeadersReader.ts +26 -26
  67. package/src/functional/$HeadersReader/index.ts +1 -1
  68. package/src/functional/$ParameterReader/$ParameterReader.ts +29 -29
  69. package/src/functional/$ParameterReader/index.ts +1 -1
  70. package/src/functional/$ProtobufReader.ts +194 -194
  71. package/src/functional/$ProtobufSizer.ts +144 -144
  72. package/src/functional/$ProtobufWriter.ts +145 -145
  73. package/src/functional/$QueryReader/$QueryReader.ts +46 -46
  74. package/src/functional/$QueryReader/index.ts +1 -1
  75. package/src/functional/$any.ts +3 -3
  76. package/src/functional/$clone.ts +48 -48
  77. package/src/functional/$convention.ts +37 -37
  78. package/src/functional/$dictionary.ts +22 -22
  79. package/src/functional/$every.ts +11 -11
  80. package/src/functional/$guard.ts +21 -21
  81. package/src/functional/$is_between.ts +2 -2
  82. package/src/functional/$join.ts +46 -46
  83. package/src/functional/$number.ts +12 -12
  84. package/src/functional/$report.ts +13 -13
  85. package/src/functional/$rest.ts +3 -3
  86. package/src/functional/$stoll.ts +8 -8
  87. package/src/functional/$string.ts +43 -43
  88. package/src/functional/$strlen.ts +7 -7
  89. package/src/functional/$tail.ts +5 -5
  90. package/src/functional/$throws.ts +10 -10
  91. package/src/functional/$varint.ts +130 -130
  92. package/src/functional/$zigzag.ts +39 -39
  93. package/src/functional/IProtobufWriter.ts +18 -18
  94. package/src/functional/Namespace/functional.ts +5 -5
  95. package/src/functional/Namespace/http.ts +9 -9
  96. package/src/functional/Namespace/index.ts +77 -77
  97. package/src/functional/Namespace/json.ts +15 -15
  98. package/src/functional/Namespace/llm.ts +20 -20
  99. package/src/functional/Namespace/misc.ts +14 -14
  100. package/src/functional/Namespace/notations.ts +23 -23
  101. package/src/functional/Namespace/protobuf.ts +20 -20
  102. package/src/functional/is.ts +10 -10
  103. package/src/functional.ts +872 -872
  104. package/src/http.ts +1266 -1266
  105. package/src/index.ts +4 -4
  106. package/src/json.ts +738 -738
  107. package/src/llm.ts +186 -186
  108. package/src/misc.ts +757 -757
  109. package/src/module.ts +1023 -1023
  110. package/src/notations.ts +1020 -1020
  111. package/src/programmers/AssertProgrammer.ts +397 -397
  112. package/src/programmers/CheckerProgrammer.ts +1138 -1138
  113. package/src/programmers/FeatureProgrammer.ts +549 -549
  114. package/src/programmers/IsProgrammer.ts +220 -220
  115. package/src/programmers/RandomProgrammer.ts +955 -955
  116. package/src/programmers/TypiaProgrammer.ts +157 -157
  117. package/src/programmers/ValidateProgrammer.ts +382 -382
  118. package/src/programmers/functional/FunctionalAssertFunctionProgrammer.ts +141 -141
  119. package/src/programmers/functional/FunctionalAssertParametersProgrammer.ts +108 -108
  120. package/src/programmers/functional/FunctionalAssertReturnProgrammer.ts +98 -98
  121. package/src/programmers/functional/FunctionalIsFunctionProgrammer.ts +72 -72
  122. package/src/programmers/functional/FunctionalIsParametersProgrammer.ts +101 -101
  123. package/src/programmers/functional/FunctionalIsReturnProgrammer.ts +106 -106
  124. package/src/programmers/functional/FunctionalValidateFunctionProgrammer.ts +123 -123
  125. package/src/programmers/functional/FunctionalValidateParametersProgrammer.ts +267 -267
  126. package/src/programmers/functional/FunctionalValidateReturnProgrammer.ts +126 -126
  127. package/src/programmers/functional/internal/FunctionalGeneralProgrammer.ts +34 -34
  128. package/src/programmers/helpers/AtomicPredicator.ts +24 -24
  129. package/src/programmers/helpers/CloneJoiner.ts +130 -130
  130. package/src/programmers/helpers/FunctionImporeter.ts +1 -1
  131. package/src/programmers/helpers/FunctionImporter.ts +97 -97
  132. package/src/programmers/helpers/HttpMetadataUtil.ts +21 -21
  133. package/src/programmers/helpers/ICheckEntry.ts +13 -13
  134. package/src/programmers/helpers/IExpressionEntry.ts +12 -12
  135. package/src/programmers/helpers/NotationJoiner.ts +132 -132
  136. package/src/programmers/helpers/OptionPredicator.ts +15 -15
  137. package/src/programmers/helpers/ProtobufUtil.ts +125 -125
  138. package/src/programmers/helpers/ProtobufWire.ts +34 -34
  139. package/src/programmers/helpers/PruneJoiner.ts +139 -139
  140. package/src/programmers/helpers/RandomJoiner.ts +145 -145
  141. package/src/programmers/helpers/RandomRanger.ts +171 -171
  142. package/src/programmers/helpers/StringifyJoinder.ts +105 -105
  143. package/src/programmers/helpers/StringifyPredicator.ts +12 -12
  144. package/src/programmers/helpers/UnionExplorer.ts +269 -269
  145. package/src/programmers/helpers/UnionPredicator.ts +77 -77
  146. package/src/programmers/helpers/disable_function_importer_declare.ts +33 -33
  147. package/src/programmers/http/HttpAssertFormDataProgrammer.ts +91 -91
  148. package/src/programmers/http/HttpAssertHeadersProgrammer.ts +91 -91
  149. package/src/programmers/http/HttpAssertQueryProgrammer.ts +93 -93
  150. package/src/programmers/http/HttpFormDataProgrammer.ts +278 -278
  151. package/src/programmers/http/HttpHeadersProgrammer.ts +347 -347
  152. package/src/programmers/http/HttpIsFormDataProgrammer.ts +102 -102
  153. package/src/programmers/http/HttpIsHeadersProgrammer.ts +102 -102
  154. package/src/programmers/http/HttpIsQueryProgrammer.ts +104 -104
  155. package/src/programmers/http/HttpParameterProgrammer.ts +97 -97
  156. package/src/programmers/http/HttpQueryProgrammer.ts +298 -298
  157. package/src/programmers/http/HttpValidateFormDataProgrammer.ts +85 -85
  158. package/src/programmers/http/HttpValidateHeadersProgrammer.ts +85 -85
  159. package/src/programmers/http/HttpValidateQueryProgrammer.ts +87 -87
  160. package/src/programmers/internal/application_array.ts +61 -61
  161. package/src/programmers/internal/application_bigint.ts +25 -25
  162. package/src/programmers/internal/application_boolean.ts +25 -25
  163. package/src/programmers/internal/application_description.ts +12 -12
  164. package/src/programmers/internal/application_escaped.ts +74 -74
  165. package/src/programmers/internal/application_number.ts +25 -25
  166. package/src/programmers/internal/application_plugin.ts +19 -19
  167. package/src/programmers/internal/application_string.ts +25 -25
  168. package/src/programmers/internal/application_templates.ts +62 -62
  169. package/src/programmers/internal/application_title.ts +20 -20
  170. package/src/programmers/internal/application_union_discriminator.ts +35 -35
  171. package/src/programmers/internal/application_v30_alias.ts +52 -52
  172. package/src/programmers/internal/application_v30_constant.ts +18 -18
  173. package/src/programmers/internal/application_v30_native.ts +28 -28
  174. package/src/programmers/internal/application_v30_object.ts +149 -149
  175. package/src/programmers/internal/application_v30_schema.ts +161 -161
  176. package/src/programmers/internal/application_v30_tuple.ts +33 -33
  177. package/src/programmers/internal/application_v31_alias.ts +41 -41
  178. package/src/programmers/internal/application_v31_constant.ts +29 -29
  179. package/src/programmers/internal/application_v31_native.ts +24 -24
  180. package/src/programmers/internal/application_v31_object.ts +130 -130
  181. package/src/programmers/internal/application_v31_schema.ts +159 -159
  182. package/src/programmers/internal/application_v31_tuple.ts +21 -21
  183. package/src/programmers/internal/check_array_length.ts +45 -45
  184. package/src/programmers/internal/check_bigint.ts +49 -49
  185. package/src/programmers/internal/check_dynamic_key.ts +174 -174
  186. package/src/programmers/internal/check_dynamic_properties.ts +211 -211
  187. package/src/programmers/internal/check_everything.ts +23 -23
  188. package/src/programmers/internal/check_native.ts +21 -21
  189. package/src/programmers/internal/check_number.ts +107 -107
  190. package/src/programmers/internal/check_object.ts +61 -61
  191. package/src/programmers/internal/check_string.ts +48 -48
  192. package/src/programmers/internal/check_template.ts +46 -46
  193. package/src/programmers/internal/check_union_array_like.ts +307 -307
  194. package/src/programmers/internal/decode_union_object.ts +99 -99
  195. package/src/programmers/internal/feature_object_entries.ts +58 -58
  196. package/src/programmers/internal/llm_schema_array.ts +22 -22
  197. package/src/programmers/internal/llm_schema_escaped.ts +61 -61
  198. package/src/programmers/internal/llm_schema_native.ts +17 -17
  199. package/src/programmers/internal/llm_schema_object.ts +129 -129
  200. package/src/programmers/internal/llm_schema_station.ts +185 -185
  201. package/src/programmers/internal/llm_schema_tuple.ts +31 -31
  202. package/src/programmers/internal/metadata_to_pattern.ts +34 -34
  203. package/src/programmers/internal/postfix_of_tuple.ts +2 -2
  204. package/src/programmers/internal/prune_object_properties.ts +60 -60
  205. package/src/programmers/internal/random_custom.ts +37 -37
  206. package/src/programmers/internal/stringify_dynamic_properties.ts +157 -157
  207. package/src/programmers/internal/stringify_native.ts +7 -7
  208. package/src/programmers/internal/stringify_regular_properties.ts +81 -81
  209. package/src/programmers/internal/template_to_pattern.ts +15 -15
  210. package/src/programmers/internal/wrap_metadata_rest_tuple.ts +20 -20
  211. package/src/programmers/json/JsonApplicationProgrammer.ts +82 -82
  212. package/src/programmers/json/JsonAssertParseProgrammer.ts +96 -96
  213. package/src/programmers/json/JsonAssertStringifyProgrammer.ts +104 -104
  214. package/src/programmers/json/JsonIsParseProgrammer.ts +110 -110
  215. package/src/programmers/json/JsonIsStringifyProgrammer.ts +102 -102
  216. package/src/programmers/json/JsonStringifyProgrammer.ts +909 -909
  217. package/src/programmers/json/JsonValidateParseProgrammer.ts +87 -87
  218. package/src/programmers/json/JsonValidateStringifyProgrammer.ts +111 -111
  219. package/src/programmers/llm/LlmApplicationProgrammer.ts +216 -216
  220. package/src/programmers/llm/LlmSchemaProgrammer.ts +49 -49
  221. package/src/programmers/misc/MiscAssertCloneProgrammer.ts +87 -87
  222. package/src/programmers/misc/MiscAssertPruneProgrammer.ts +105 -105
  223. package/src/programmers/misc/MiscCloneProgrammer.ts +781 -781
  224. package/src/programmers/misc/MiscIsCloneProgrammer.ts +93 -93
  225. package/src/programmers/misc/MiscIsPruneProgrammer.ts +91 -91
  226. package/src/programmers/misc/MiscLiteralsProgrammer.ts +70 -70
  227. package/src/programmers/misc/MiscPruneProgrammer.ts +560 -560
  228. package/src/programmers/misc/MiscValidateCloneProgrammer.ts +104 -104
  229. package/src/programmers/misc/MiscValidatePruneProgrammer.ts +101 -101
  230. package/src/programmers/notations/NotationAssertGeneralProgrammer.ts +91 -91
  231. package/src/programmers/notations/NotationGeneralProgrammer.ts +714 -714
  232. package/src/programmers/notations/NotationIsGeneralProgrammer.ts +97 -97
  233. package/src/programmers/notations/NotationValidateGeneralProgrammer.ts +110 -110
  234. package/src/programmers/protobuf/ProtobufAssertDecodeProgrammer.ts +91 -91
  235. package/src/programmers/protobuf/ProtobufAssertEncodeProgrammer.ts +95 -95
  236. package/src/programmers/protobuf/ProtobufDecodeProgrammer.ts +646 -646
  237. package/src/programmers/protobuf/ProtobufEncodeProgrammer.ts +852 -852
  238. package/src/programmers/protobuf/ProtobufIsDecodeProgrammer.ts +104 -104
  239. package/src/programmers/protobuf/ProtobufIsEncodeProgrammer.ts +93 -93
  240. package/src/programmers/protobuf/ProtobufMessageProgrammer.ts +160 -160
  241. package/src/programmers/protobuf/ProtobufValidateDecodeProgrammer.ts +85 -85
  242. package/src/programmers/protobuf/ProtobufValidateEncodeProgrammer.ts +109 -109
  243. package/src/protobuf.ts +999 -999
  244. package/src/reflect.ts +63 -63
  245. package/src/schemas/json/IJsonApplication.ts +22 -22
  246. package/src/schemas/metadata/IJsDocTagInfo.ts +10 -10
  247. package/src/schemas/metadata/IMetadata.ts +36 -36
  248. package/src/schemas/metadata/IMetadataAlias.ts +12 -12
  249. package/src/schemas/metadata/IMetadataApplication.ts +7 -7
  250. package/src/schemas/metadata/IMetadataArray.ts +7 -7
  251. package/src/schemas/metadata/IMetadataArrayType.ts +10 -10
  252. package/src/schemas/metadata/IMetadataAtomic.ts +6 -6
  253. package/src/schemas/metadata/IMetadataComponents.ts +11 -11
  254. package/src/schemas/metadata/IMetadataConstant.ts +18 -18
  255. package/src/schemas/metadata/IMetadataConstantValue.ts +11 -11
  256. package/src/schemas/metadata/IMetadataDictionary.ts +11 -11
  257. package/src/schemas/metadata/IMetadataEntry.ts +6 -6
  258. package/src/schemas/metadata/IMetadataEscaped.ts +6 -6
  259. package/src/schemas/metadata/IMetadataFunction.ts +8 -8
  260. package/src/schemas/metadata/IMetadataObject.ts +13 -13
  261. package/src/schemas/metadata/IMetadataParameter.ts +9 -9
  262. package/src/schemas/metadata/IMetadataProperty.ts +9 -9
  263. package/src/schemas/metadata/IMetadataTemplate.ts +7 -7
  264. package/src/schemas/metadata/IMetadataTuple.ts +7 -7
  265. package/src/schemas/metadata/IMetadataTupleType.ts +10 -10
  266. package/src/schemas/metadata/IMetadataTypeTag.ts +16 -16
  267. package/src/schemas/metadata/Metadata.ts +616 -616
  268. package/src/schemas/metadata/MetadataAlias.ts +61 -61
  269. package/src/schemas/metadata/MetadataApplication.ts +44 -44
  270. package/src/schemas/metadata/MetadataArray.ts +49 -49
  271. package/src/schemas/metadata/MetadataArrayType.ts +57 -57
  272. package/src/schemas/metadata/MetadataAtomic.ts +87 -87
  273. package/src/schemas/metadata/MetadataComponents.ts +98 -98
  274. package/src/schemas/metadata/MetadataConstant.ts +34 -34
  275. package/src/schemas/metadata/MetadataConstantValue.ts +62 -62
  276. package/src/schemas/metadata/MetadataEscaped.ts +51 -51
  277. package/src/schemas/metadata/MetadataFunction.ts +49 -49
  278. package/src/schemas/metadata/MetadataObject.ts +139 -139
  279. package/src/schemas/metadata/MetadataParameter.ts +50 -50
  280. package/src/schemas/metadata/MetadataProperty.ts +56 -56
  281. package/src/schemas/metadata/MetadataTemplate.ts +80 -80
  282. package/src/schemas/metadata/MetadataTuple.ts +32 -32
  283. package/src/schemas/metadata/MetadataTupleType.ts +67 -67
  284. package/src/tags/Constant.ts +15 -15
  285. package/src/tags/ContentMediaType.ts +10 -10
  286. package/src/tags/Default.ts +22 -22
  287. package/src/tags/ExclusiveMaximum.ts +25 -25
  288. package/src/tags/ExclusiveMinimum.ts +25 -25
  289. package/src/tags/Format.ts +16 -16
  290. package/src/tags/JsonSchemaPlugin.ts +8 -8
  291. package/src/tags/MaxItems.ts +12 -12
  292. package/src/tags/MaxLength.ts +12 -12
  293. package/src/tags/Maximum.ts +19 -19
  294. package/src/tags/MinItems.ts +12 -12
  295. package/src/tags/MinLength.ts +12 -12
  296. package/src/tags/Minimum.ts +19 -19
  297. package/src/tags/MultipleOf.ts +21 -21
  298. package/src/tags/Pattern.ts +31 -31
  299. package/src/tags/TagBase.ts +76 -76
  300. package/src/tags/Type.ts +32 -32
  301. package/src/tags/UniqueItems.ts +14 -14
  302. package/src/tags/index.ts +18 -18
  303. package/src/tags/internal/FormatCheatSheet.ts +73 -73
  304. package/src/transform.ts +35 -35
  305. package/src/transformers/CallExpressionTransformer.ts +508 -508
  306. package/src/transformers/FileTransformer.ts +91 -91
  307. package/src/transformers/IProject.ts +15 -15
  308. package/src/transformers/ITransformOptions.ts +62 -62
  309. package/src/transformers/ImportTransformer.ts +66 -66
  310. package/src/transformers/NodeTransformer.ts +13 -13
  311. package/src/transformers/TransformerError.ts +60 -60
  312. package/src/transformers/features/AssertTransformer.ts +16 -16
  313. package/src/transformers/features/CreateAssertTransformer.ts +16 -16
  314. package/src/transformers/features/CreateIsTransformer.ts +10 -10
  315. package/src/transformers/features/CreateRandomTransformer.ts +40 -40
  316. package/src/transformers/features/CreateValidateTransformer.ts +13 -13
  317. package/src/transformers/features/IsTransformer.ts +10 -10
  318. package/src/transformers/features/RandomTransformer.ts +44 -44
  319. package/src/transformers/features/ValidateTransformer.ts +11 -11
  320. package/src/transformers/features/functional/FunctionalGenericTransformer.ts +57 -57
  321. package/src/transformers/features/http/CreateHttpAssertFormDataTransformer.ts +12 -12
  322. package/src/transformers/features/http/CreateHttpAssertHeadersTransformer.ts +11 -11
  323. package/src/transformers/features/http/CreateHttpAssertQueryTransformer.ts +9 -9
  324. package/src/transformers/features/http/CreateHttpFormDataTransformer.ts +9 -9
  325. package/src/transformers/features/http/CreateHttpHeadersTransformer.ts +9 -9
  326. package/src/transformers/features/http/CreateHttpIsFormDataTransformer.ts +9 -9
  327. package/src/transformers/features/http/CreateHttpIsHeadersTransformer.ts +9 -9
  328. package/src/transformers/features/http/CreateHttpIsQueryTransformer.ts +9 -9
  329. package/src/transformers/features/http/CreateHttpParameterTransformer.ts +9 -9
  330. package/src/transformers/features/http/CreateHttpQueryTransformer.ts +9 -9
  331. package/src/transformers/features/http/CreateHttpValidateFormDataTransformer.ts +12 -12
  332. package/src/transformers/features/http/CreateHttpValidateHeadersTransformer.ts +12 -12
  333. package/src/transformers/features/http/CreateHttpValidateQueryTransformer.ts +11 -11
  334. package/src/transformers/features/http/HttpAssertFormDataTransformer.ts +10 -10
  335. package/src/transformers/features/http/HttpAssertHeadersTransformer.ts +9 -9
  336. package/src/transformers/features/http/HttpAssertQueryTransformer.ts +9 -9
  337. package/src/transformers/features/http/HttpFormDataTransformer.ts +9 -9
  338. package/src/transformers/features/http/HttpHeadersTransformer.ts +9 -9
  339. package/src/transformers/features/http/HttpIsFormDataTransformer.ts +9 -9
  340. package/src/transformers/features/http/HttpIsHeadersTransformer.ts +9 -9
  341. package/src/transformers/features/http/HttpIsQueryTransformer.ts +9 -9
  342. package/src/transformers/features/http/HttpParameterTransformer.ts +9 -9
  343. package/src/transformers/features/http/HttpQueryTransformer.ts +9 -9
  344. package/src/transformers/features/http/HttpValidateFormDataTransformer.ts +10 -10
  345. package/src/transformers/features/http/HttpValidateHeadersTransformer.ts +10 -10
  346. package/src/transformers/features/http/HttpValidateQueryTransformer.ts +9 -9
  347. package/src/transformers/features/json/JsonApplicationTransformer.ts +124 -124
  348. package/src/transformers/features/json/JsonAssertParseTransformer.ts +9 -9
  349. package/src/transformers/features/json/JsonAssertStringifyTransformer.ts +10 -10
  350. package/src/transformers/features/json/JsonCreateAssertParseTransformer.ts +9 -9
  351. package/src/transformers/features/json/JsonCreateAssertStringifyTransformer.ts +12 -12
  352. package/src/transformers/features/json/JsonCreateIsParseTransformer.ts +9 -9
  353. package/src/transformers/features/json/JsonCreateIsStringifyTransformer.ts +9 -9
  354. package/src/transformers/features/json/JsonCreateStringifyTransformer.ts +9 -9
  355. package/src/transformers/features/json/JsonCreateValidateParseTransformer.ts +11 -11
  356. package/src/transformers/features/json/JsonCreateValidateStringifyProgrammer.ts +12 -12
  357. package/src/transformers/features/json/JsonIsParseTransformer.ts +9 -9
  358. package/src/transformers/features/json/JsonIsStringifyTransformer.ts +9 -9
  359. package/src/transformers/features/json/JsonStringifyTransformer.ts +9 -9
  360. package/src/transformers/features/json/JsonValidateParseTransformer.ts +9 -9
  361. package/src/transformers/features/json/JsonValidateStringifyTransformer.ts +10 -10
  362. package/src/transformers/features/llm/LlmApplicationTransformer.ts +83 -83
  363. package/src/transformers/features/llm/LlmSchemaTransformer.ts +53 -53
  364. package/src/transformers/features/misc/MiscAssertCloneTransformer.ts +9 -9
  365. package/src/transformers/features/misc/MiscAssertPruneTransformer.ts +9 -9
  366. package/src/transformers/features/misc/MiscCloneTransformer.ts +9 -9
  367. package/src/transformers/features/misc/MiscCreateAssertCloneTransformer.ts +9 -9
  368. package/src/transformers/features/misc/MiscCreateAssertPruneTransformer.ts +9 -9
  369. package/src/transformers/features/misc/MiscCreateCloneTransformer.ts +9 -9
  370. package/src/transformers/features/misc/MiscCreateIsCloneTransformer.ts +9 -9
  371. package/src/transformers/features/misc/MiscCreateIsPruneTransformer.ts +9 -9
  372. package/src/transformers/features/misc/MiscCreatePruneTransformer.ts +9 -9
  373. package/src/transformers/features/misc/MiscCreateValidateCloneTransformer.ts +11 -11
  374. package/src/transformers/features/misc/MiscCreateValidatePruneTransformer.ts +11 -11
  375. package/src/transformers/features/misc/MiscIsCloneTransformer.ts +9 -9
  376. package/src/transformers/features/misc/MiscIsPruneTransformer.ts +9 -9
  377. package/src/transformers/features/misc/MiscLiteralsTransformer.ts +32 -32
  378. package/src/transformers/features/misc/MiscPruneTransformer.ts +9 -9
  379. package/src/transformers/features/misc/MiscValidateCloneTransformer.ts +9 -9
  380. package/src/transformers/features/misc/MiscValidatePruneTransformer.ts +9 -9
  381. package/src/transformers/features/notations/NotationAssertGeneralTransformer.ts +15 -15
  382. package/src/transformers/features/notations/NotationCreateAssertGeneralTransformer.ts +15 -15
  383. package/src/transformers/features/notations/NotationCreateGeneralTransformer.ts +15 -15
  384. package/src/transformers/features/notations/NotationCreateIsGeneralTransformer.ts +15 -15
  385. package/src/transformers/features/notations/NotationCreateValidateGeneralTransformer.ts +15 -15
  386. package/src/transformers/features/notations/NotationGeneralTransformer.ts +11 -11
  387. package/src/transformers/features/notations/NotationIsGeneralTransformer.ts +15 -15
  388. package/src/transformers/features/notations/NotationValidateGeneralTransformer.ts +15 -15
  389. package/src/transformers/features/protobuf/ProtobufAssertDecodeTransformer.ts +10 -10
  390. package/src/transformers/features/protobuf/ProtobufAssertEncodeTransformer.ts +10 -10
  391. package/src/transformers/features/protobuf/ProtobufCreateAssertDecodeTransformer.ts +12 -12
  392. package/src/transformers/features/protobuf/ProtobufCreateAssertEncodeTransformer.ts +12 -12
  393. package/src/transformers/features/protobuf/ProtobufCreateDecodeTransformer.ts +9 -9
  394. package/src/transformers/features/protobuf/ProtobufCreateEncodeTransformer.ts +9 -9
  395. package/src/transformers/features/protobuf/ProtobufCreateIsDecodeTransformer.ts +9 -9
  396. package/src/transformers/features/protobuf/ProtobufCreateIsEncodeTransformer.ts +9 -9
  397. package/src/transformers/features/protobuf/ProtobufCreateValidateDecodeTransformer.ts +12 -12
  398. package/src/transformers/features/protobuf/ProtobufCreateValidateEncodeTransformer.ts +12 -12
  399. package/src/transformers/features/protobuf/ProtobufDecodeTransformer.ts +9 -9
  400. package/src/transformers/features/protobuf/ProtobufEncodeTransformer.ts +9 -9
  401. package/src/transformers/features/protobuf/ProtobufIsDecodeTransformer.ts +9 -9
  402. package/src/transformers/features/protobuf/ProtobufIsEncodeTransformer.ts +9 -9
  403. package/src/transformers/features/protobuf/ProtobufMessageTransformer.ts +33 -33
  404. package/src/transformers/features/protobuf/ProtobufValidateDecodeTransformer.ts +10 -10
  405. package/src/transformers/features/protobuf/ProtobufValidateEncodeTransformer.ts +10 -10
  406. package/src/transformers/features/reflect/ReflectMetadataTransformer.ts +63 -63
  407. package/src/transformers/features/reflect/ReflectNameTransformer.ts +66 -66
  408. package/src/transformers/internal/GenericTransformer.ts +104 -104
  409. package/src/typings/Atomic.ts +13 -13
  410. package/src/typings/ClassProperties.ts +5 -5
  411. package/src/typings/Customizable.ts +5 -5
  412. package/src/typings/Equal.ts +18 -18
  413. package/src/typings/IsTuple.ts +9 -9
  414. package/src/typings/NativeClass.ts +23 -23
  415. package/src/typings/OmitNever.ts +3 -3
  416. package/src/typings/ProtobufAtomic.ts +19 -19
  417. package/src/typings/SpecialFields.ts +3 -3
  418. package/src/typings/ValidationPipe.ts +9 -9
  419. package/src/typings/ValueOf.ts +20 -20
  420. package/src/typings/Writable.ts +11 -11
  421. package/src/utils/ArrayUtil.ts +41 -41
  422. package/src/utils/Escaper.ts +50 -50
  423. package/src/utils/MapUtil.ts +12 -12
  424. package/src/utils/NameEncoder.ts +32 -32
  425. package/src/utils/NamingConvention/NamingConvention.ts +89 -89
  426. package/src/utils/NamingConvention/index.ts +1 -1
  427. package/src/utils/PatternUtil.ts +29 -29
  428. package/src/utils/RandomGenerator/RandomGenerator.ts +119 -119
  429. package/src/utils/RandomGenerator/index.ts +1 -1
  430. package/src/utils/Singleton.ts +16 -16
  431. package/src/utils/StringUtil/StringUtil.ts +7 -7
  432. package/src/utils/StringUtil/index.ts +1 -1
package/src/module.ts CHANGED
@@ -1,1023 +1,1023 @@
1
- import * as Namespace from "./functional/Namespace";
2
-
3
- import { AssertionGuard } from "./AssertionGuard";
4
- import { IRandomGenerator } from "./IRandomGenerator";
5
- import { IValidation } from "./IValidation";
6
- import { Resolved } from "./Resolved";
7
- import { TypeGuardError } from "./TypeGuardError";
8
-
9
- export * as functional from "./functional";
10
- export * as http from "./http";
11
- export * as llm from "./llm";
12
- export * as json from "./json";
13
- export * as misc from "./misc";
14
- export * as notations from "./notations";
15
- export * as protobuf from "./protobuf";
16
- export * as reflect from "./reflect";
17
- export * as tags from "./tags";
18
-
19
- export * from "./schemas/metadata/IJsDocTagInfo";
20
- export * from "./schemas/json/IJsonApplication";
21
- export * from "./AssertionGuard";
22
- export * from "./IRandomGenerator";
23
- export * from "./IValidation";
24
- export * from "./TypeGuardError";
25
-
26
- export * from "./Primitive";
27
- export * from "./Resolved";
28
- export * from "./CamelCase";
29
- export * from "./PascalCase";
30
- export * from "./SnakeCase";
31
-
32
- /* -----------------------------------------------------------
33
- BASIC VALIDATORS
34
- ----------------------------------------------------------- */
35
- /**
36
- * Asserts a value type.
37
- *
38
- * Asserts a parametric value type and throws a {@link TypeGuardError} with detailed
39
- * reason, if the parametric value is not following the type `T`. Otherwise, the
40
- * value is following the type `T`, just input parameter would be returned.
41
- *
42
- * If what you want is not asserting but just knowing whether the parametric value is
43
- * following the type `T` or not, you can choose the {@link is} function instead.
44
- * Otherwise you want to know all the errors, {@link validate} is the way to go.
45
- * Also, if you want to automatically cast the parametric value to the type `T`
46
- * when no problem (perform the assertion guard of type).
47
- *
48
- * On the other and, if you don't want to allow any superfluous property that is not
49
- * enrolled to the type `T`, you can use {@link assertEquals} function instead.
50
- *
51
- * @template T Type of the input value
52
- * @param input A value to be asserted
53
- * @param errorFactory Custom error factory. Default is `TypeGuardError`
54
- * @returns Parametric input value
55
- * @throws A {@link TypeGuardError} instance with detailed reason
56
- *
57
- * @author Jeongho Nam - https://github.com/samchon
58
- */
59
- function assert<T>(
60
- input: T,
61
- errorFactory?: undefined | ((props: TypeGuardError.IProps) => Error),
62
- ): T;
63
-
64
- /**
65
- * Asserts a value type.
66
- *
67
- * Asserts a parametric value type and throws a {@link TypeGuardError} with detailed
68
- * reason, if the parametric value is not following the type `T`. Otherwise, the
69
- * value is following the type `T`, just input parameter would be returned.
70
- *
71
- * If what you want is not asserting but just knowing whether the parametric value is
72
- * following the type `T` or not, you can choose the {@link is} function instead.
73
- * Otherwise, you want to know all the errors, {@link validate} is the way to go.
74
- *
75
- * On the other and, if you don't want to allow any superfluous property that is not
76
- * enrolled to the type `T`, you can use {@link assertEquals} function instead.
77
- *
78
- * @template T Type of the input value
79
- * @param input A value to be asserted
80
- * @param errorFactory Custom error factory. Default is `TypeGuardError`
81
- * @returns Parametric input value casted as `T`
82
- * @throws A {@link TypeGuardError} instance with detailed reason
83
- *
84
- * @author Jeongho Nam - https://github.com/samchon
85
- */
86
- function assert<T>(
87
- input: unknown,
88
- errorFactory?: undefined | ((props: TypeGuardError.IProps) => Error),
89
- ): T;
90
-
91
- /**
92
- * @internal
93
- */
94
- function assert(): never {
95
- halt("assert");
96
- }
97
- const assertPure = /** @__PURE__ */ Object.assign<typeof assert, {}>(
98
- assert,
99
- /** @__PURE__ */ Namespace.assert("assert"),
100
- );
101
- export { assertPure as assert };
102
-
103
- /**
104
- * Assertion guard of a value type.
105
- *
106
- * Asserts a parametric value type and throws a {@link TypeGuardError} with detailed
107
- * reason, if the parametric value is not following the type `T`. Otherwise, the
108
- * value is following the type `T`, nothing would be returned, but the input value
109
- * would be automatically casted to the type `T`. This is the concept of
110
- * "Assertion Guard" of a value type.
111
- *
112
- * If what you want is not asserting but just knowing whether the parametric value is
113
- * following the type `T` or not, you can choose the {@link is} function instead.
114
- * Otherwise you want to know all the errors, {@link validate} is the way to go.
115
- * Also, if you want to returns the parametric value when no problem, you can use
116
- * {@link assert} function instead.
117
- *
118
- * On the other and, if you don't want to allow any superfluous property that is not
119
- * enrolled to the type `T`, you can use {@link assertGuardEquals} function instead.
120
- *
121
- * @template T Type of the input value
122
- * @param input A value to be asserted
123
- * @param errorFactory Custom error factory. Default is `TypeGuardError`
124
- * @throws A {@link TypeGuardError} instance with detailed reason
125
- *
126
- * @author Jeongho Nam - https://github.com/samchon
127
- */
128
- function assertGuard<T>(
129
- input: T,
130
- errorFactory?: undefined | ((props: TypeGuardError.IProps) => Error),
131
- ): asserts input is T;
132
-
133
- /**
134
- * Assertion guard of a value type.
135
- *
136
- * Asserts a parametric value type and throws a {@link TypeGuardError} with detailed
137
- * reason, if the parametric value is not following the type `T`. Otherwise, the
138
- * value is following the type `T`, nothing would be returned, but the input value
139
- * would be automatically casted to the type `T`. This is the concept of
140
- * "Assertion Guard" of a value type.
141
- *
142
- * If what you want is not asserting but just knowing whether the parametric value is
143
- * following the type `T` or not, you can choose the {@link is} function instead.
144
- * Otherwise you want to know all the errors, {@link validate} is the way to go.
145
- * Also, if you want to returns the parametric value when no problem, you can use
146
- * {@link assert} function instead.
147
- *
148
- * On the other and, if you don't want to allow any superfluous property that is not
149
- * enrolled to the type `T`, you can use {@link assertGuardEquals} function instead.
150
- *
151
- * @template T Type of the input value
152
- * @param input A value to be asserted
153
- * @param errorFactory Custom error factory. Default is `TypeGuardError`
154
- * @throws A {@link TypeGuardError} instance with detailed reason
155
- *
156
- * @author Jeongho Nam - https://github.com/samchon
157
- */
158
- function assertGuard<T>(
159
- input: unknown,
160
- errorFactory?: undefined | ((props: TypeGuardError.IProps) => Error),
161
- ): asserts input is T;
162
-
163
- /**
164
- * @internal
165
- */
166
- function assertGuard(): never {
167
- halt("assertGuard");
168
- }
169
- const assertGuardPure = /** @__PURE__ */ Object.assign<typeof assertGuard, {}>(
170
- assertGuard,
171
- /** @__PURE__ */ Namespace.assert("assertGuard"),
172
- );
173
- export { assertGuardPure as assertGuard };
174
-
175
- /**
176
- * Tests a value type.
177
- *
178
- * Tests a parametric value type and returns whether it's following the type `T` or not.
179
- * If the parametric value is matched with the type `T`, `true` value would be returned.
180
- * Otherwise, the parametric value is not following the type `T`, `false` value would be
181
- * returned.
182
- *
183
- * If what you want is not just knowing whether the parametric value is following the
184
- * type `T` or not, but throwing an exception with detailed reason, you can choose
185
- * {@link assert} function instead. Also, if you want to know all the errors with
186
- * detailed reasons, {@link validate} function would be useful.
187
- *
188
- * On the other and, if you don't want to allow any superfluous property that is not
189
- * enrolled to the type `T`, you can use {@link equals} function instead.
190
- *
191
- * @template T Type of the input value
192
- * @param input A value to be tested
193
- * @param errorFactory Custom error factory. Default is `TypeGuardError`
194
- * @returns Whether the parametric value is following the type `T` or not
195
- *
196
- * @author Jeongho Nam - https://github.com/samchon
197
- */
198
- function is<T>(input: T): input is T;
199
-
200
- /**
201
- * Tests a value type.
202
- *
203
- * Tests a parametric value type and returns whether it's following the type `T` or not.
204
- * If the parametric value is matched with the type `T`, `true` value would be returned.
205
- * Otherwise, the parametric value is not following the type `T`, `false` value would be
206
- * returned.
207
- *
208
- * If what you want is not just knowing whether the parametric value is following the
209
- * type `T` or not, but throwing an exception with detailed reason, you can choose
210
- * {@link assert} function instead. Also, if you want to know all the errors with
211
- * detailed reasons, {@link validate} function would be useful.
212
- *
213
- * On the other and, if you don't want to allow any superfluous property that is not
214
- * enrolled to the type `T`, you can use {@link equals} function instead.
215
- *
216
- * @template T Type of the input value
217
- * @param input A value to be tested
218
- * @returns Whether the parametric value is following the type `T` or not
219
- *
220
- * @author Jeongho Nam - https://github.com/samchon
221
- */
222
- function is<T>(input: unknown): input is T;
223
-
224
- /**
225
- * @internal
226
- */
227
- function is(): never {
228
- halt("is");
229
- }
230
- const isPure = /** @__PURE__ */ Object.assign<typeof is, {}>(
231
- is,
232
- /** @__PURE__ */ Namespace.assert("is"),
233
- );
234
- export { isPure as is };
235
-
236
- /**
237
- * Validates a value type.
238
- *
239
- * Validates a parametric value type and archives all the type errors into an
240
- * {@link IValidation.errors} array, if the parametric value is not following the
241
- * type `T`. Of course, if the parametric value is following the type `T`, the
242
- * {@link IValidation.errors} array would be empty and {@link IValidation.success}
243
- * would have the `true` value.
244
- *
245
- * If what you want is not finding all the error, but asserting the parametric value
246
- * type with exception throwing, you can choose {@link assert} function instead.
247
- * Otherwise, you just want to know whether the parametric value is matched with the
248
- * type `T`, {@link is} function is the way to go.
249
- *
250
- * On the other and, if you don't want to allow any superfluous property that is not
251
- * enrolled to the type `T`, you can use {@link validateEquals} function instead.
252
- *
253
- * @template Type of the input value
254
- * @param input A value to be validated
255
- * @returns Validation result
256
- *
257
- * @author Jeongho Nam - https://github.com/samchon
258
- */
259
- function validate<T>(input: T): IValidation<T>;
260
-
261
- /**
262
- * Validates a value type.
263
- *
264
- * Validates a parametric value type and archives all the type errors into an
265
- * {@link IValidation.errors} array, if the parametric value is not following the
266
- * type `T`. Of course, if the parametric value is following the type `T`, the
267
- * {@link IValidation.errors} array would be empty and {@link IValidation.success}
268
- * would have the `true` value.
269
- *
270
- * If what you want is not finding all the error, but asserting the parametric value
271
- * type with exception throwing, you can choose {@link assert} function instead.
272
- * Otherwise, you just want to know whether the parametric value is matched with the
273
- * type `T`, {@link is} function is the way to go.
274
- *
275
- * On the other and, if you don't want to allow any superfluous property that is not
276
- * enrolled to the type `T`, you can use {@link validateEquals} function instead.
277
- *
278
- * @template Type of the input value
279
- * @param input A value to be validated
280
- * @returns Validation result
281
- *
282
- * @author Jeongho Nam - https://github.com/samchon
283
- */
284
- function validate<T>(input: unknown): IValidation<T>;
285
-
286
- /**
287
- * @internal
288
- */
289
- function validate(): never {
290
- halt("validate");
291
- }
292
- const validatePure = /** @__PURE__ */ Object.assign<typeof validate, {}>(
293
- validate,
294
- /** @__PURE__ */ Namespace.validate(),
295
- );
296
- export { validatePure as validate };
297
-
298
- /* -----------------------------------------------------------
299
- STRICT VALIDATORS
300
- ----------------------------------------------------------- */
301
- /**
302
- * Asserts equality between a value and its type.
303
- *
304
- * Asserts a parametric value type and throws a {@link TypeGuardError} with detailed
305
- * reason, if the parametric value is not following the type `T` or some superfluous
306
- * property that is not listed on the type `T` has been found. Otherwise, the value is
307
- * following the type `T` without any superfluous property, just input parameter would
308
- * be returned.
309
- *
310
- * If what you want is not asserting but just knowing whether the parametric value is
311
- * following the type `T` or not, you can choose the {@link equals} function instead.
312
- * Otherwise, you want to know all the errors, {@link validateEquals} is the way to go.
313
- *
314
- * On the other hand, if you want to allow superfluous property that is not enrolled
315
- * to the type `T`, you can use {@link assert} function instead.
316
- *
317
- * @template T Type of the input value
318
- * @param input A value to be asserted
319
- * @param errorFactory Custom error factory. Default is `TypeGuardError`
320
- * @returns Parametric input value
321
- * @throws A {@link TypeGuardError} instance with detailed reason
322
- *
323
- * @author Jeongho Nam - https://github.com/samchon
324
- */
325
- function assertEquals<T>(
326
- input: T,
327
- errorFactory?: undefined | ((props: TypeGuardError.IProps) => Error),
328
- ): T;
329
-
330
- /**
331
- * Asserts equality between a value and its type.
332
- *
333
- * Asserts a parametric value type and throws a {@link TypeGuardError} with detailed
334
- * reason, if the parametric value is not following the type `T` or some superfluous
335
- * property that is not listed on the type `T` has been found. Otherwise, the value is
336
- * following the type `T` without any superfluous property, just input parameter would
337
- * be returned.
338
- *
339
- * If what you want is not asserting but just knowing whether the parametric value is
340
- * following the type `T` or not, you can choose the {@link equals} function instead.
341
- * Otherwise, you want to know all the errors, {@link validateEquals} is the way to go.
342
- *
343
- * On the other hand, if you want to allow superfluous property that is not enrolled
344
- * to the type `T`, you can use {@link assert} function instead.
345
- *
346
- * @template T Type of the input value
347
- * @param input A value to be asserted
348
- * @param errorFactory Custom error factory. Default is `TypeGuardError`
349
- * @returns Parametric input value casted as `T`
350
- * @throws A {@link TypeGuardError} instance with detailed reason
351
- *
352
- * @author Jeongho Nam - https://github.com/samchon
353
- */
354
- function assertEquals<T>(
355
- input: unknown,
356
- errorFactory?: undefined | ((props: TypeGuardError.IProps) => Error),
357
- ): T;
358
-
359
- /**
360
- * @internal
361
- */
362
- function assertEquals(): never {
363
- halt("assertEquals");
364
- }
365
- const assertEqualsPure = /** @__PURE__ */ Object.assign<
366
- typeof assertEquals,
367
- {}
368
- >(assertEquals, /** @__PURE__ */ Namespace.assert("assertEquals"));
369
- export { assertEqualsPure as assertEquals };
370
-
371
- /**
372
- * Assertion guard of a type with equality.
373
- *
374
- * Asserts a parametric value type and throws a {@link TypeGuardError} with detailed
375
- * reason, if the parametric value is not following the type `T` or some superfluous
376
- * property that is not listed on the type `T` has been found.
377
- *
378
- * Otherwise, the value is following the type `T` without any superfluous property,
379
- * nothing would be returned, but the input value would be automatically casted to
380
- * the type `T`. This is the concept of "Assertion Guard" of a value type.
381
- *
382
- * If what you want is not asserting but just knowing whether the parametric value is
383
- * following the type `T` or not, you can choose the {@link equals} function instead.
384
- * Otherwise, you want to know all the errors, {@link validateEquals} is the way to go.
385
- * Also, if you want to returns the parametric value when no problem, you can use
386
- * {@link assert} function instead.
387
- *
388
- * On the other hand, if you want to allow superfluous property that is not enrolled
389
- * to the type `T`, you can use {@link assertEquals} function instead.
390
- *
391
- * @template T Type of the input value
392
- * @param input A value to be asserted
393
- * @param errorFactory Custom error factory. Default is `TypeGuardError`
394
- * @returns Parametric input value casted as `T`
395
- * @throws A {@link TypeGuardError} instance with detailed reason
396
- *
397
- * @author Jeongho Nam - https://github.com/samchon
398
- */
399
- function assertGuardEquals<T>(
400
- input: T,
401
- errorFactory?: undefined | ((props: TypeGuardError.IProps) => Error),
402
- ): asserts input is T;
403
-
404
- /**
405
- * Assertion guard of a type with equality.
406
- *
407
- * Asserts a parametric value type and throws a {@link TypeGuardError} with detailed
408
- * reason, if the parametric value is not following the type `T` or some superfluous
409
- * property that is not listed on the type `T` has been found.
410
- *
411
- * Otherwise, the value is following the type `T` without any superfluous property,
412
- * nothing would be returned, but the input value would be automatically casted to
413
- * the type `T`. This is the concept of "Assertion Guard" of a value type.
414
- *
415
- * If what you want is not asserting but just knowing whether the parametric value is
416
- * following the type `T` or not, you can choose the {@link equals} function instead.
417
- * Otherwise, you want to know all the errors, {@link validateEquals} is the way to go.
418
- * Also, if you want to returns the parametric value when no problem, you can use
419
- * {@link assertEquals} function instead.
420
- *
421
- * On the other hand, if you want to allow superfluous property that is not enrolled
422
- * to the type `T`, you can use {@link assertGuard} function instead.
423
- *
424
- * @template T Type of the input value
425
- * @param input A value to be asserted
426
- * @param errorFactory Custom error factory. Default is `TypeGuardError`
427
- * @returns Parametric input value casted as `T`
428
- * @throws A {@link TypeGuardError} instance with detailed reason
429
- *
430
- * @author Jeongho Nam - https://github.com/samchon
431
- */
432
- function assertGuardEquals<T>(
433
- input: unknown,
434
- errorFactory?: undefined | ((props: TypeGuardError.IProps) => Error),
435
- ): asserts input is T;
436
-
437
- /**
438
- * @internal
439
- */
440
- function assertGuardEquals(): never {
441
- halt("assertGuardEquals");
442
- }
443
- const assertGuardEqualsPure = /** @__PURE__ */ Object.assign<
444
- typeof assertGuardEquals,
445
- {}
446
- >(assertGuardEquals, /** @__PURE__ */ Namespace.assert("assertGuardEquals"));
447
- export { assertGuardEqualsPure as assertGuardEquals };
448
-
449
- /**
450
- * Tests equality between a value and its type.
451
- *
452
- * Tests a parametric value type and returns whether it's equivalent to the type `T`
453
- * or not. If the parametric value is matched with the type `T` and there's not any
454
- * superfluous property that is not listed on the type `T`, `true` value would be
455
- * returned. Otherwise, the parametric value is not following the type `T` or some
456
- * superfluous property exists, `false` value would be returned.
457
- *
458
- * If what you want is not just knowing whether the parametric value is following the
459
- * type `T` or not, but throwing an exception with detailed reason, you can choose
460
- * {@link assertEquals} function instead. Also, if you want to know all the errors with
461
- * detailed reasons, {@link validateEquals} function would be useful.
462
- *
463
- * On the other hand, if you want to allow superfluous property that is not enrolled
464
- * to the type `T`, you can use {@link is} function instead.
465
- *
466
- * @template T Type of the input value
467
- * @param input A value to be tested
468
- * @returns Whether the parametric value is equivalent to the type `T` or not
469
- *
470
- * @author Jeongho Nam - https://github.com/samchon
471
- */
472
- function equals<T>(input: T): input is T;
473
-
474
- /**
475
- * Tests equality between a value and its type.
476
- *
477
- * Tests a parametric value type and returns whether it's equivalent to the type `T`
478
- * or not. If the parametric value is matched with the type `T` and there's not any
479
- * superfluous property that is not listed on the type `T`, `true` value would be
480
- * returned. Otherwise, the parametric value is not following the type `T` or some
481
- * superfluous property exists, `false` value would be returned.
482
- *
483
- * If what you want is not just knowing whether the parametric value is following the
484
- * type `T` or not, but throwing an exception with detailed reason, you can choose
485
- * {@link assertEquals} function instead. Also, if you want to know all the errors with
486
- * detailed reasons, {@link validateEquals} function would be useful.
487
- *
488
- * On the other hand, if you want to allow superfluous property that is not enrolled
489
- * to the type `T`, you can use {@link is} function instead.
490
- *
491
- * @template T Type of the input value
492
- * @param input A value to be tested
493
- * @returns Whether the parametric value is equivalent to the type `T` or not
494
- *
495
- * @author Jeongho Nam - https://github.com/samchon
496
- */
497
- function equals<T>(input: unknown): input is T;
498
-
499
- /**
500
- * @internal
501
- */
502
- function equals(): never {
503
- halt("equals");
504
- }
505
- const equalsPure = /** @__PURE__ */ Object.assign<typeof equals, {}>(
506
- equals,
507
- /** @__PURE__ */ Namespace.is(),
508
- );
509
- export { equalsPure as equals };
510
-
511
- /**
512
- * Validates equality between a value and its type.
513
- *
514
- * Validates a parametric value type and archives all the type errors into an
515
- * {@link IValidation.errors} array, if the parametric value is not following the
516
- * type `T` or some superfluous property that is not listed on the type `T` has been
517
- * found. Of course, if the parametric value is following the type `T` and no
518
- * superfluous property exists, the {@link IValidation.errors} array would be empty
519
- * and {@link IValidation.success} would have the `true` value.
520
- *
521
- * If what you want is not finding all the error, but asserting the parametric value
522
- * type with exception throwing, you can choose {@link assert} function instead.
523
- * Otherwise, you just want to know whether the parametric value is matched with the
524
- * type `T`, {@link is} function is the way to go.
525
- *
526
- * On the other and, if you don't want to allow any superfluous property that is not
527
- * enrolled to the type `T`, you can use {@link validateEquals} function instead.
528
- *
529
- * @template Type of the input value
530
- * @param input A value to be validated
531
- * @returns Validation result
532
- *
533
- * @author Jeongho Nam - https://github.com/samchon
534
- */
535
- function validateEquals<T>(input: T): IValidation<T>;
536
-
537
- /**
538
- * Validates equality between a value and its type.
539
- *
540
- * Validates a parametric value type and archives all the type errors into an
541
- * {@link IValidation.errors} array, if the parametric value is not following the
542
- * type `T` or some superfluous property that is not listed on the type `T` has been
543
- * found. Of course, if the parametric value is following the type `T` and no
544
- * superfluous property exists, the {@link IValidation.errors} array would be empty
545
- * and {@link IValidation.success} would have the `true` value.
546
- *
547
- * If what you want is not finding all the error, but asserting the parametric value
548
- * type with exception throwing, you can choose {@link assert} function instead.
549
- * Otherwise, you just want to know whether the parametric value is matched with the
550
- * type `T`, {@link is} function is the way to go.
551
- *
552
- * On the other and, if you don't want to allow any superfluous property that is not
553
- * enrolled to the type `T`, you can use {@link validateEquals} function instead.
554
- *
555
- * @template Type of the input value
556
- * @param input A value to be validated
557
- * @returns Validation result
558
- *
559
- * @author Jeongho Nam - https://github.com/samchon
560
- */
561
- function validateEquals<T>(input: unknown): IValidation<T>;
562
-
563
- /**
564
- * @internal
565
- */
566
- function validateEquals(): never {
567
- halt("validateEquals");
568
- }
569
- const validateEqualsPure = /** @__PURE__ */ Object.assign<
570
- typeof validateEquals,
571
- {}
572
- >(validateEquals, /** @__PURE__ */ Namespace.validate());
573
- export { validateEqualsPure as validateEquals };
574
-
575
- /* -----------------------------------------------------------
576
- RANDOM
577
- ----------------------------------------------------------- */
578
- /**
579
- * > You must configure the generic argument `T`.
580
- *
581
- * Generate random data.
582
- *
583
- * Generates a random data following type the `T`.
584
- *
585
- * For reference, this `typia.random()` function generates only primitive type.
586
- * If there're some methods in the type `T` or its nested instances, those would
587
- * be ignored. Also, when the type `T` has a `toJSON()` method, its return type
588
- * would be generated instead.
589
- *
590
- * @template T Type of data to generate
591
- * @param generator Random data generator
592
- * @return Randomly generated data
593
- *
594
- * @author Jeongho Nam - https://github.com/samchon
595
- */
596
- function random(generator?: Partial<IRandomGenerator>): never;
597
-
598
- /**
599
- * Generate random data.
600
- *
601
- * Generates a random data following type the `T`.
602
- *
603
- * For reference, this `typia.random()` function generates only primitive type.
604
- * If there're some methods in the type `T` or its nested instances, those would
605
- * be ignored. Also, when the type `T` has a `toJSON()` method, its return type
606
- * would be generated instead.
607
- *
608
- * @template T Type of data to generate
609
- * @param generator Random data generator
610
- * @return Randomly generated data
611
- *
612
- * @author Jeongho Nam - https://github.com/samchon
613
- */
614
- function random<T>(generator?: Partial<IRandomGenerator>): Resolved<T>;
615
-
616
- /**
617
- * @internal
618
- */
619
- function random(): never {
620
- halt("random");
621
- }
622
- const randomPure = /** @__PURE__ */ Object.assign<typeof random, {}>(
623
- random,
624
- /** @__PURE__ */ Namespace.random(),
625
- );
626
- export { randomPure as random };
627
-
628
- /* -----------------------------------------------------------
629
- FACTORY FUNCTIONS
630
- ----------------------------------------------------------- */
631
- /**
632
- * Creates a reusable {@link assert} function.
633
- *
634
- * @danger You must configure the generic argument `T`
635
- * @param errorFactory Custom error factory. Default is `TypeGuardError`
636
- * @returns Nothing until you configure the generic argument `T`
637
- * @throws compile error
638
- *
639
- * @author Jeongho Nam - https://github.com/samchon
640
- */
641
- function createAssert(
642
- errorFactory?: undefined | ((props: TypeGuardError.IProps) => Error),
643
- ): never;
644
-
645
- /**
646
- * Creates a reusable {@link assert} function.
647
- *
648
- * @template T Type of the input value
649
- * @param errorFactory Custom error factory. Default is `TypeGuardError`
650
- * @returns A reusable `assert` function
651
- *
652
- * @author Jeongho Nam - https://github.com/samchon
653
- */
654
- function createAssert<T>(
655
- errorFactory?: undefined | ((props: TypeGuardError.IProps) => Error),
656
- ): (input: unknown) => T;
657
-
658
- /**
659
- * @internal
660
- */
661
- function createAssert<T>(): (input: unknown) => T {
662
- halt("createAssert");
663
- }
664
- const createAssertPure = /** @__PURE__ */ Object.assign<
665
- typeof createAssert,
666
- {}
667
- >(createAssert, assertPure);
668
- export { createAssertPure as createAssert };
669
-
670
- /**
671
- * Creates a reusable {@link assertGuard} function.
672
- *
673
- * Note that, you've to declare the variable type of the factory function caller
674
- * like below. If you don't declare the variable type, compilation error be thrown.
675
- * This is the special rule of the TypeScript compiler.
676
- *
677
- * ```typescript
678
- * // MUST DECLARE THE VARIABLE TYPE
679
- * const func: typia.AssertionGuard<number> = typia.createAssertGuard<number>();
680
- *
681
- * // IF NOT, COMPILATION ERROR BE OCCURED
682
- * const func = typia.createAssertGuard<number>();
683
- * ```
684
- *
685
- * > *Assertions require every name in the call target to be declared with an*
686
- * > *explicit type annotation.*
687
- *
688
- * @danger You must configure the generic argument `T`
689
- * @param errorFactory Custom error factory. Default is `TypeGuardError`
690
- * @returns Nothing until you configure the generic argument `T`
691
- * @throws compile error
692
- *
693
- * @author Jeongho Nam - https://github.com/samchon
694
- */
695
- function createAssertGuard(
696
- errorFactory?: undefined | ((props: TypeGuardError.IProps) => Error),
697
- ): never;
698
-
699
- /**
700
- * Creates a reusable {@link assertGuard} function.
701
- *
702
- * Note that, you've to declare the variable type of the factory function caller
703
- * like below. If you don't declare the variable type, compilation error be thrown.
704
- * This is the special rule of the TypeScript compiler.
705
- *
706
- * ```typescript
707
- * // MUST DECLARE THE VARIABLE TYPE
708
- * const func: typia.AssertionGuard<number> = typia.createAssertGuard<number>();
709
- *
710
- * // IF NOT, COMPILATION ERROR BE OCCURED
711
- * const func = typia.createAssertGuard<number>();
712
- * ```
713
- *
714
- * > *Assertions require every name in the call target to be declared with an*
715
- * > *explicit type annotation.*
716
- *
717
- * @returns Nothing until you configure the generic argument `T`
718
- * @param errorFactory Custom error factory. Default is `TypeGuardError`
719
- * @throws compile error
720
- *
721
- * @author Jeongho Nam - https://github.com/samchon
722
- */
723
- function createAssertGuard<T>(
724
- errorFactory?: undefined | ((props: TypeGuardError.IProps) => Error),
725
- ): (input: unknown) => AssertionGuard<T>;
726
-
727
- /**
728
- * @internal
729
- */
730
- function createAssertGuard<T>(): (input: unknown) => AssertionGuard<T> {
731
- halt("createAssertGuard");
732
- }
733
- const createAssertGuardPure = /** @__PURE__ */ Object.assign<
734
- typeof createAssertGuard,
735
- {}
736
- >(createAssertGuard, assertGuardPure);
737
- export { createAssertGuardPure as createAssertGuard };
738
-
739
- /**
740
- * Creates a reusable {@link is} function.
741
- *
742
- * @danger You must configure the generic argument `T`
743
- * @returns Nothing until you configure the generic argument `T`
744
- * @throws compile error
745
- *
746
- * @author Jeongho Nam - https://github.com/samchon
747
- */
748
- function createIs(): never;
749
-
750
- /**
751
- * Creates a reusable {@link is} function.
752
- *
753
- * @template T Type of the input value
754
- * @returns A reusable `is` function
755
- *
756
- * @author Jeongho Nam - https://github.com/samchon
757
- */
758
- function createIs<T>(): (input: unknown) => input is T;
759
-
760
- /**
761
- * @internal
762
- */
763
- function createIs<T>(): (input: unknown) => input is T {
764
- halt("createIs");
765
- }
766
- const createIsPure = /** @__PURE__ */ Object.assign<typeof createIs, {}>(
767
- createIs,
768
- isPure,
769
- );
770
- export { createIsPure as createIs };
771
-
772
- /**
773
- * Creates a reusable {@link validate} function.
774
- *
775
- * @danger You must configure the generic argument `T`
776
- * @returns Nothing until you configure the generic argument `T`
777
- * @throws compile error
778
- *
779
- * @author Jeongho Nam - https://github.com/samchon
780
- */
781
- function createValidate(): never;
782
-
783
- /**
784
- * Creates a reusable {@link validate} function.
785
- *
786
- * @template T Type of the input value
787
- * @returns A reusable `validate` function
788
- *
789
- * @author Jeongho Nam - https://github.com/samchon
790
- */
791
- function createValidate<T>(): (input: unknown) => IValidation<T>;
792
-
793
- /**
794
- * @internal
795
- */
796
- function createValidate(): (input: unknown) => IValidation {
797
- halt("createValidate");
798
- }
799
- const createValidatePure = /** @__PURE__ */ Object.assign<
800
- typeof createValidate,
801
- {}
802
- >(createValidate, validatePure);
803
- export { createValidatePure as createValidate };
804
-
805
- /**
806
- * Creates a reusable {@link assertEquals} function.
807
- *
808
- * @danger You must configure the generic argument `T`
809
- * @param errorFactory Custom error factory. Default is `TypeGuardError`
810
- * @returns Nothing until you configure the generic argument `T`
811
- * @throws compile error
812
- *
813
- * @author Jeongho Nam - https://github.com/samchon
814
- */
815
- function createAssertEquals(
816
- errorFactory?: undefined | ((props: TypeGuardError.IProps) => Error),
817
- ): never;
818
-
819
- /**
820
- * Creates a reusable {@link assertEquals} function.
821
- *
822
- * @template T Type of the input value
823
- * @param errorFactory Custom error factory. Default is `TypeGuardError`
824
- * @returns A reusable `assertEquals` function
825
- *
826
- * @author Jeongho Nam - https://github.com/samchon
827
- */
828
- function createAssertEquals<T>(
829
- errorFactory?: undefined | ((props: TypeGuardError.IProps) => Error),
830
- ): (input: unknown) => T;
831
-
832
- /**
833
- * @internal
834
- */
835
- function createAssertEquals<T>(): (input: unknown) => T {
836
- halt("createAssertEquals");
837
- }
838
- const createAssertEqualsPure = /** @__PURE__ */ Object.assign<
839
- typeof createAssertEquals,
840
- {}
841
- >(createAssertEquals, assertEqualsPure);
842
- export { createAssertEqualsPure as createAssertEquals };
843
-
844
- /**
845
- * Creates a reusable {@link assertGuardEquals} function.
846
- *
847
- * Note that, you've to declare the variable type of the factory function caller
848
- * like below. If you don't declare the variable type, compilation error be thrown.
849
- * This is the special rule of the TypeScript compiler.
850
- *
851
- * ```typescript
852
- * // MUST DECLARE THE VARIABLE TYPE
853
- * const func: typia.AssertionGuard<number> = typia.createAssertGuardEquals<number>();
854
- *
855
- * // IF NOT, COMPILATION ERROR BE OCCURED
856
- * const func = typia.createAssertGuardEquals<number>();
857
- * ```
858
- *
859
- * > *Assertions require every name in the call target to be declared with an*
860
- * > *explicit type annotation.*
861
- *
862
- * @danger You must configure the generic argument `T`
863
- * @param errorFactory Custom error factory. Default is `TypeGuardError`
864
- * @returns Nothing until you configure the generic argument `T`
865
- * @throws compile error
866
- *
867
- * @author Jeongho Nam - https://github.com/samchon
868
- */
869
- function createAssertGuardEquals(
870
- errorFactory?: undefined | ((props: TypeGuardError.IProps) => Error),
871
- ): never;
872
-
873
- /**
874
- * Creates a reusable {@link assertGuardEquals} function.
875
- *
876
- * Note that, you've to declare the variable type of the factory function caller
877
- * like below. If you don't declare the variable type, compilation error be thrown.
878
- * This is the special rule of the TypeScript compiler.
879
- *
880
- * ```typescript
881
- * // MUST DECLARE THE VARIABLE TYPE
882
- * const func: typia.AssertionGuard<number> = typia.createAssertGuardEquals<number>();
883
- *
884
- * // IF NOT, COMPILATION ERROR BE OCCURED
885
- * const func = typia.createAssertGuardEquals<number>();
886
- * ```
887
- *
888
- * > *Assertions require every name in the call target to be declared with an*
889
- * > *explicit type annotation.*
890
- *
891
- * @param errorFactory Custom error factory. Default is `TypeGuardError`
892
- * @returns Nothing until you configure the generic argument `T`
893
- * @throws compile error
894
- *
895
- * @author Jeongho Nam - https://github.com/samchon
896
- */
897
- function createAssertGuardEquals<T>(
898
- errorFactory?: undefined | ((props: TypeGuardError.IProps) => Error),
899
- ): (input: unknown) => AssertionGuard<T>;
900
-
901
- /**
902
- * @internal
903
- */
904
- function createAssertGuardEquals<T>(): (input: unknown) => AssertionGuard<T> {
905
- halt("createAssertGuardEquals");
906
- }
907
- const createAssertGuardEqualsPure = /** @__PURE__ */ Object.assign<
908
- typeof createAssertGuardEquals,
909
- {}
910
- >(createAssertGuardEquals, assertGuardEqualsPure);
911
- export { createAssertGuardEqualsPure as createAssertGuardEquals };
912
-
913
- /**
914
- * Creates a reusable {@link equals} function.
915
- *
916
- * @danger You must configure the generic argument `T`
917
- * @returns Nothing until you configure the generic argument `T`
918
- * @throws compile error
919
- *
920
- * @author Jeongho Nam - https://github.com/samchon
921
- */
922
- function createEquals(): never;
923
-
924
- /**
925
- * Creates a reusable {@link equals} function.
926
- *
927
- * @template T Type of the input value
928
- * @returns A reusable `equals` function
929
- *
930
- * @author Jeongho Nam - https://github.com/samchon
931
- */
932
- function createEquals<T>(): (input: unknown) => input is T;
933
-
934
- /**
935
- * @internal
936
- */
937
- function createEquals<T>(): (input: unknown) => input is T {
938
- halt("createEquals");
939
- }
940
- const createEqualsPure = /** @__PURE__ */ Object.assign<
941
- typeof createEquals,
942
- {}
943
- >(createEquals, equalsPure);
944
- export { createEqualsPure as createEquals };
945
-
946
- /**
947
- * Creates a reusable {@link validateEquals} function.
948
- *
949
- * @danger You must configure the generic argument `T`
950
- * @returns Nothing until you configure the generic argument `T`
951
- * @throws compile error
952
- *
953
- * @author Jeongho Nam - https://github.com/samchon
954
- */
955
- function createValidateEquals(): never;
956
-
957
- /**
958
- * Creates a reusable {@link validateEquals} function.
959
- *
960
- * @template T Type of the input value
961
- * @returns A reusable `validateEquals` function
962
- *
963
- * @author Jeongho Nam - https://github.com/samchon
964
- */
965
- function createValidateEquals<T>(): (input: unknown) => IValidation<T>;
966
-
967
- /**
968
- * @internal
969
- */
970
- function createValidateEquals(): (input: unknown) => IValidation {
971
- halt("createValidateEquals");
972
- }
973
- const createValidateEqualsPure = /** @__PURE__ */ Object.assign<
974
- typeof createValidateEquals,
975
- {}
976
- >(createValidateEquals, validateEqualsPure);
977
- export { createValidateEqualsPure as createValidateEquals };
978
-
979
- /**
980
- * Creates a reusable {@link random} function.
981
- *
982
- * @danger You must configure the generic argument `T`
983
- * @param generator Random data generator
984
- * @returns Nothing until you configure the generic argument `T`
985
- * @throws compile error
986
- *
987
- * @author Jeongho Nam - https://github.com/samchon
988
- */
989
- function createRandom(generator?: Partial<IRandomGenerator>): never;
990
-
991
- /**
992
- * Creates a resuable {@link random} function.
993
- *
994
- * @template T Type of the input value
995
- * @param generator Random data generator
996
- * @returns A reusable `random` function
997
- *
998
- * @author Jeongho Nam - https://github.com/samchon
999
- */
1000
- function createRandom<T>(
1001
- generator?: Partial<IRandomGenerator>,
1002
- ): () => Resolved<T>;
1003
-
1004
- /**
1005
- * @internal
1006
- */
1007
- function createRandom(): never {
1008
- halt("createRandom");
1009
- }
1010
- const createRandomPure = /** @__PURE__ */ Object.assign<
1011
- typeof createRandom,
1012
- {}
1013
- >(createRandom, randomPure);
1014
- export { createRandomPure as createRandom };
1015
-
1016
- /**
1017
- * @internal
1018
- */
1019
- function halt(name: string): never {
1020
- throw new Error(
1021
- `Error on typia.${name}(): no transform has been configured. Read and follow https://typia.io/docs/setup please.`,
1022
- );
1023
- }
1
+ import * as Namespace from "./functional/Namespace";
2
+
3
+ import { AssertionGuard } from "./AssertionGuard";
4
+ import { IRandomGenerator } from "./IRandomGenerator";
5
+ import { IValidation } from "./IValidation";
6
+ import { Resolved } from "./Resolved";
7
+ import { TypeGuardError } from "./TypeGuardError";
8
+
9
+ export * as functional from "./functional";
10
+ export * as http from "./http";
11
+ export * as llm from "./llm";
12
+ export * as json from "./json";
13
+ export * as misc from "./misc";
14
+ export * as notations from "./notations";
15
+ export * as protobuf from "./protobuf";
16
+ export * as reflect from "./reflect";
17
+ export * as tags from "./tags";
18
+
19
+ export * from "./schemas/metadata/IJsDocTagInfo";
20
+ export * from "./schemas/json/IJsonApplication";
21
+ export * from "./AssertionGuard";
22
+ export * from "./IRandomGenerator";
23
+ export * from "./IValidation";
24
+ export * from "./TypeGuardError";
25
+
26
+ export * from "./Primitive";
27
+ export * from "./Resolved";
28
+ export * from "./CamelCase";
29
+ export * from "./PascalCase";
30
+ export * from "./SnakeCase";
31
+
32
+ /* -----------------------------------------------------------
33
+ BASIC VALIDATORS
34
+ ----------------------------------------------------------- */
35
+ /**
36
+ * Asserts a value type.
37
+ *
38
+ * Asserts a parametric value type and throws a {@link TypeGuardError} with detailed
39
+ * reason, if the parametric value is not following the type `T`. Otherwise, the
40
+ * value is following the type `T`, just input parameter would be returned.
41
+ *
42
+ * If what you want is not asserting but just knowing whether the parametric value is
43
+ * following the type `T` or not, you can choose the {@link is} function instead.
44
+ * Otherwise you want to know all the errors, {@link validate} is the way to go.
45
+ * Also, if you want to automatically cast the parametric value to the type `T`
46
+ * when no problem (perform the assertion guard of type).
47
+ *
48
+ * On the other and, if you don't want to allow any superfluous property that is not
49
+ * enrolled to the type `T`, you can use {@link assertEquals} function instead.
50
+ *
51
+ * @template T Type of the input value
52
+ * @param input A value to be asserted
53
+ * @param errorFactory Custom error factory. Default is `TypeGuardError`
54
+ * @returns Parametric input value
55
+ * @throws A {@link TypeGuardError} instance with detailed reason
56
+ *
57
+ * @author Jeongho Nam - https://github.com/samchon
58
+ */
59
+ function assert<T>(
60
+ input: T,
61
+ errorFactory?: undefined | ((props: TypeGuardError.IProps) => Error),
62
+ ): T;
63
+
64
+ /**
65
+ * Asserts a value type.
66
+ *
67
+ * Asserts a parametric value type and throws a {@link TypeGuardError} with detailed
68
+ * reason, if the parametric value is not following the type `T`. Otherwise, the
69
+ * value is following the type `T`, just input parameter would be returned.
70
+ *
71
+ * If what you want is not asserting but just knowing whether the parametric value is
72
+ * following the type `T` or not, you can choose the {@link is} function instead.
73
+ * Otherwise, you want to know all the errors, {@link validate} is the way to go.
74
+ *
75
+ * On the other and, if you don't want to allow any superfluous property that is not
76
+ * enrolled to the type `T`, you can use {@link assertEquals} function instead.
77
+ *
78
+ * @template T Type of the input value
79
+ * @param input A value to be asserted
80
+ * @param errorFactory Custom error factory. Default is `TypeGuardError`
81
+ * @returns Parametric input value casted as `T`
82
+ * @throws A {@link TypeGuardError} instance with detailed reason
83
+ *
84
+ * @author Jeongho Nam - https://github.com/samchon
85
+ */
86
+ function assert<T>(
87
+ input: unknown,
88
+ errorFactory?: undefined | ((props: TypeGuardError.IProps) => Error),
89
+ ): T;
90
+
91
+ /**
92
+ * @internal
93
+ */
94
+ function assert(): never {
95
+ halt("assert");
96
+ }
97
+ const assertPure = /** @__PURE__ */ Object.assign<typeof assert, {}>(
98
+ assert,
99
+ /** @__PURE__ */ Namespace.assert("assert"),
100
+ );
101
+ export { assertPure as assert };
102
+
103
+ /**
104
+ * Assertion guard of a value type.
105
+ *
106
+ * Asserts a parametric value type and throws a {@link TypeGuardError} with detailed
107
+ * reason, if the parametric value is not following the type `T`. Otherwise, the
108
+ * value is following the type `T`, nothing would be returned, but the input value
109
+ * would be automatically casted to the type `T`. This is the concept of
110
+ * "Assertion Guard" of a value type.
111
+ *
112
+ * If what you want is not asserting but just knowing whether the parametric value is
113
+ * following the type `T` or not, you can choose the {@link is} function instead.
114
+ * Otherwise you want to know all the errors, {@link validate} is the way to go.
115
+ * Also, if you want to returns the parametric value when no problem, you can use
116
+ * {@link assert} function instead.
117
+ *
118
+ * On the other and, if you don't want to allow any superfluous property that is not
119
+ * enrolled to the type `T`, you can use {@link assertGuardEquals} function instead.
120
+ *
121
+ * @template T Type of the input value
122
+ * @param input A value to be asserted
123
+ * @param errorFactory Custom error factory. Default is `TypeGuardError`
124
+ * @throws A {@link TypeGuardError} instance with detailed reason
125
+ *
126
+ * @author Jeongho Nam - https://github.com/samchon
127
+ */
128
+ function assertGuard<T>(
129
+ input: T,
130
+ errorFactory?: undefined | ((props: TypeGuardError.IProps) => Error),
131
+ ): asserts input is T;
132
+
133
+ /**
134
+ * Assertion guard of a value type.
135
+ *
136
+ * Asserts a parametric value type and throws a {@link TypeGuardError} with detailed
137
+ * reason, if the parametric value is not following the type `T`. Otherwise, the
138
+ * value is following the type `T`, nothing would be returned, but the input value
139
+ * would be automatically casted to the type `T`. This is the concept of
140
+ * "Assertion Guard" of a value type.
141
+ *
142
+ * If what you want is not asserting but just knowing whether the parametric value is
143
+ * following the type `T` or not, you can choose the {@link is} function instead.
144
+ * Otherwise you want to know all the errors, {@link validate} is the way to go.
145
+ * Also, if you want to returns the parametric value when no problem, you can use
146
+ * {@link assert} function instead.
147
+ *
148
+ * On the other and, if you don't want to allow any superfluous property that is not
149
+ * enrolled to the type `T`, you can use {@link assertGuardEquals} function instead.
150
+ *
151
+ * @template T Type of the input value
152
+ * @param input A value to be asserted
153
+ * @param errorFactory Custom error factory. Default is `TypeGuardError`
154
+ * @throws A {@link TypeGuardError} instance with detailed reason
155
+ *
156
+ * @author Jeongho Nam - https://github.com/samchon
157
+ */
158
+ function assertGuard<T>(
159
+ input: unknown,
160
+ errorFactory?: undefined | ((props: TypeGuardError.IProps) => Error),
161
+ ): asserts input is T;
162
+
163
+ /**
164
+ * @internal
165
+ */
166
+ function assertGuard(): never {
167
+ halt("assertGuard");
168
+ }
169
+ const assertGuardPure = /** @__PURE__ */ Object.assign<typeof assertGuard, {}>(
170
+ assertGuard,
171
+ /** @__PURE__ */ Namespace.assert("assertGuard"),
172
+ );
173
+ export { assertGuardPure as assertGuard };
174
+
175
+ /**
176
+ * Tests a value type.
177
+ *
178
+ * Tests a parametric value type and returns whether it's following the type `T` or not.
179
+ * If the parametric value is matched with the type `T`, `true` value would be returned.
180
+ * Otherwise, the parametric value is not following the type `T`, `false` value would be
181
+ * returned.
182
+ *
183
+ * If what you want is not just knowing whether the parametric value is following the
184
+ * type `T` or not, but throwing an exception with detailed reason, you can choose
185
+ * {@link assert} function instead. Also, if you want to know all the errors with
186
+ * detailed reasons, {@link validate} function would be useful.
187
+ *
188
+ * On the other and, if you don't want to allow any superfluous property that is not
189
+ * enrolled to the type `T`, you can use {@link equals} function instead.
190
+ *
191
+ * @template T Type of the input value
192
+ * @param input A value to be tested
193
+ * @param errorFactory Custom error factory. Default is `TypeGuardError`
194
+ * @returns Whether the parametric value is following the type `T` or not
195
+ *
196
+ * @author Jeongho Nam - https://github.com/samchon
197
+ */
198
+ function is<T>(input: T): input is T;
199
+
200
+ /**
201
+ * Tests a value type.
202
+ *
203
+ * Tests a parametric value type and returns whether it's following the type `T` or not.
204
+ * If the parametric value is matched with the type `T`, `true` value would be returned.
205
+ * Otherwise, the parametric value is not following the type `T`, `false` value would be
206
+ * returned.
207
+ *
208
+ * If what you want is not just knowing whether the parametric value is following the
209
+ * type `T` or not, but throwing an exception with detailed reason, you can choose
210
+ * {@link assert} function instead. Also, if you want to know all the errors with
211
+ * detailed reasons, {@link validate} function would be useful.
212
+ *
213
+ * On the other and, if you don't want to allow any superfluous property that is not
214
+ * enrolled to the type `T`, you can use {@link equals} function instead.
215
+ *
216
+ * @template T Type of the input value
217
+ * @param input A value to be tested
218
+ * @returns Whether the parametric value is following the type `T` or not
219
+ *
220
+ * @author Jeongho Nam - https://github.com/samchon
221
+ */
222
+ function is<T>(input: unknown): input is T;
223
+
224
+ /**
225
+ * @internal
226
+ */
227
+ function is(): never {
228
+ halt("is");
229
+ }
230
+ const isPure = /** @__PURE__ */ Object.assign<typeof is, {}>(
231
+ is,
232
+ /** @__PURE__ */ Namespace.assert("is"),
233
+ );
234
+ export { isPure as is };
235
+
236
+ /**
237
+ * Validates a value type.
238
+ *
239
+ * Validates a parametric value type and archives all the type errors into an
240
+ * {@link IValidation.errors} array, if the parametric value is not following the
241
+ * type `T`. Of course, if the parametric value is following the type `T`, the
242
+ * {@link IValidation.errors} array would be empty and {@link IValidation.success}
243
+ * would have the `true` value.
244
+ *
245
+ * If what you want is not finding all the error, but asserting the parametric value
246
+ * type with exception throwing, you can choose {@link assert} function instead.
247
+ * Otherwise, you just want to know whether the parametric value is matched with the
248
+ * type `T`, {@link is} function is the way to go.
249
+ *
250
+ * On the other and, if you don't want to allow any superfluous property that is not
251
+ * enrolled to the type `T`, you can use {@link validateEquals} function instead.
252
+ *
253
+ * @template Type of the input value
254
+ * @param input A value to be validated
255
+ * @returns Validation result
256
+ *
257
+ * @author Jeongho Nam - https://github.com/samchon
258
+ */
259
+ function validate<T>(input: T): IValidation<T>;
260
+
261
+ /**
262
+ * Validates a value type.
263
+ *
264
+ * Validates a parametric value type and archives all the type errors into an
265
+ * {@link IValidation.errors} array, if the parametric value is not following the
266
+ * type `T`. Of course, if the parametric value is following the type `T`, the
267
+ * {@link IValidation.errors} array would be empty and {@link IValidation.success}
268
+ * would have the `true` value.
269
+ *
270
+ * If what you want is not finding all the error, but asserting the parametric value
271
+ * type with exception throwing, you can choose {@link assert} function instead.
272
+ * Otherwise, you just want to know whether the parametric value is matched with the
273
+ * type `T`, {@link is} function is the way to go.
274
+ *
275
+ * On the other and, if you don't want to allow any superfluous property that is not
276
+ * enrolled to the type `T`, you can use {@link validateEquals} function instead.
277
+ *
278
+ * @template Type of the input value
279
+ * @param input A value to be validated
280
+ * @returns Validation result
281
+ *
282
+ * @author Jeongho Nam - https://github.com/samchon
283
+ */
284
+ function validate<T>(input: unknown): IValidation<T>;
285
+
286
+ /**
287
+ * @internal
288
+ */
289
+ function validate(): never {
290
+ halt("validate");
291
+ }
292
+ const validatePure = /** @__PURE__ */ Object.assign<typeof validate, {}>(
293
+ validate,
294
+ /** @__PURE__ */ Namespace.validate(),
295
+ );
296
+ export { validatePure as validate };
297
+
298
+ /* -----------------------------------------------------------
299
+ STRICT VALIDATORS
300
+ ----------------------------------------------------------- */
301
+ /**
302
+ * Asserts equality between a value and its type.
303
+ *
304
+ * Asserts a parametric value type and throws a {@link TypeGuardError} with detailed
305
+ * reason, if the parametric value is not following the type `T` or some superfluous
306
+ * property that is not listed on the type `T` has been found. Otherwise, the value is
307
+ * following the type `T` without any superfluous property, just input parameter would
308
+ * be returned.
309
+ *
310
+ * If what you want is not asserting but just knowing whether the parametric value is
311
+ * following the type `T` or not, you can choose the {@link equals} function instead.
312
+ * Otherwise, you want to know all the errors, {@link validateEquals} is the way to go.
313
+ *
314
+ * On the other hand, if you want to allow superfluous property that is not enrolled
315
+ * to the type `T`, you can use {@link assert} function instead.
316
+ *
317
+ * @template T Type of the input value
318
+ * @param input A value to be asserted
319
+ * @param errorFactory Custom error factory. Default is `TypeGuardError`
320
+ * @returns Parametric input value
321
+ * @throws A {@link TypeGuardError} instance with detailed reason
322
+ *
323
+ * @author Jeongho Nam - https://github.com/samchon
324
+ */
325
+ function assertEquals<T>(
326
+ input: T,
327
+ errorFactory?: undefined | ((props: TypeGuardError.IProps) => Error),
328
+ ): T;
329
+
330
+ /**
331
+ * Asserts equality between a value and its type.
332
+ *
333
+ * Asserts a parametric value type and throws a {@link TypeGuardError} with detailed
334
+ * reason, if the parametric value is not following the type `T` or some superfluous
335
+ * property that is not listed on the type `T` has been found. Otherwise, the value is
336
+ * following the type `T` without any superfluous property, just input parameter would
337
+ * be returned.
338
+ *
339
+ * If what you want is not asserting but just knowing whether the parametric value is
340
+ * following the type `T` or not, you can choose the {@link equals} function instead.
341
+ * Otherwise, you want to know all the errors, {@link validateEquals} is the way to go.
342
+ *
343
+ * On the other hand, if you want to allow superfluous property that is not enrolled
344
+ * to the type `T`, you can use {@link assert} function instead.
345
+ *
346
+ * @template T Type of the input value
347
+ * @param input A value to be asserted
348
+ * @param errorFactory Custom error factory. Default is `TypeGuardError`
349
+ * @returns Parametric input value casted as `T`
350
+ * @throws A {@link TypeGuardError} instance with detailed reason
351
+ *
352
+ * @author Jeongho Nam - https://github.com/samchon
353
+ */
354
+ function assertEquals<T>(
355
+ input: unknown,
356
+ errorFactory?: undefined | ((props: TypeGuardError.IProps) => Error),
357
+ ): T;
358
+
359
+ /**
360
+ * @internal
361
+ */
362
+ function assertEquals(): never {
363
+ halt("assertEquals");
364
+ }
365
+ const assertEqualsPure = /** @__PURE__ */ Object.assign<
366
+ typeof assertEquals,
367
+ {}
368
+ >(assertEquals, /** @__PURE__ */ Namespace.assert("assertEquals"));
369
+ export { assertEqualsPure as assertEquals };
370
+
371
+ /**
372
+ * Assertion guard of a type with equality.
373
+ *
374
+ * Asserts a parametric value type and throws a {@link TypeGuardError} with detailed
375
+ * reason, if the parametric value is not following the type `T` or some superfluous
376
+ * property that is not listed on the type `T` has been found.
377
+ *
378
+ * Otherwise, the value is following the type `T` without any superfluous property,
379
+ * nothing would be returned, but the input value would be automatically casted to
380
+ * the type `T`. This is the concept of "Assertion Guard" of a value type.
381
+ *
382
+ * If what you want is not asserting but just knowing whether the parametric value is
383
+ * following the type `T` or not, you can choose the {@link equals} function instead.
384
+ * Otherwise, you want to know all the errors, {@link validateEquals} is the way to go.
385
+ * Also, if you want to returns the parametric value when no problem, you can use
386
+ * {@link assert} function instead.
387
+ *
388
+ * On the other hand, if you want to allow superfluous property that is not enrolled
389
+ * to the type `T`, you can use {@link assertEquals} function instead.
390
+ *
391
+ * @template T Type of the input value
392
+ * @param input A value to be asserted
393
+ * @param errorFactory Custom error factory. Default is `TypeGuardError`
394
+ * @returns Parametric input value casted as `T`
395
+ * @throws A {@link TypeGuardError} instance with detailed reason
396
+ *
397
+ * @author Jeongho Nam - https://github.com/samchon
398
+ */
399
+ function assertGuardEquals<T>(
400
+ input: T,
401
+ errorFactory?: undefined | ((props: TypeGuardError.IProps) => Error),
402
+ ): asserts input is T;
403
+
404
+ /**
405
+ * Assertion guard of a type with equality.
406
+ *
407
+ * Asserts a parametric value type and throws a {@link TypeGuardError} with detailed
408
+ * reason, if the parametric value is not following the type `T` or some superfluous
409
+ * property that is not listed on the type `T` has been found.
410
+ *
411
+ * Otherwise, the value is following the type `T` without any superfluous property,
412
+ * nothing would be returned, but the input value would be automatically casted to
413
+ * the type `T`. This is the concept of "Assertion Guard" of a value type.
414
+ *
415
+ * If what you want is not asserting but just knowing whether the parametric value is
416
+ * following the type `T` or not, you can choose the {@link equals} function instead.
417
+ * Otherwise, you want to know all the errors, {@link validateEquals} is the way to go.
418
+ * Also, if you want to returns the parametric value when no problem, you can use
419
+ * {@link assertEquals} function instead.
420
+ *
421
+ * On the other hand, if you want to allow superfluous property that is not enrolled
422
+ * to the type `T`, you can use {@link assertGuard} function instead.
423
+ *
424
+ * @template T Type of the input value
425
+ * @param input A value to be asserted
426
+ * @param errorFactory Custom error factory. Default is `TypeGuardError`
427
+ * @returns Parametric input value casted as `T`
428
+ * @throws A {@link TypeGuardError} instance with detailed reason
429
+ *
430
+ * @author Jeongho Nam - https://github.com/samchon
431
+ */
432
+ function assertGuardEquals<T>(
433
+ input: unknown,
434
+ errorFactory?: undefined | ((props: TypeGuardError.IProps) => Error),
435
+ ): asserts input is T;
436
+
437
+ /**
438
+ * @internal
439
+ */
440
+ function assertGuardEquals(): never {
441
+ halt("assertGuardEquals");
442
+ }
443
+ const assertGuardEqualsPure = /** @__PURE__ */ Object.assign<
444
+ typeof assertGuardEquals,
445
+ {}
446
+ >(assertGuardEquals, /** @__PURE__ */ Namespace.assert("assertGuardEquals"));
447
+ export { assertGuardEqualsPure as assertGuardEquals };
448
+
449
+ /**
450
+ * Tests equality between a value and its type.
451
+ *
452
+ * Tests a parametric value type and returns whether it's equivalent to the type `T`
453
+ * or not. If the parametric value is matched with the type `T` and there's not any
454
+ * superfluous property that is not listed on the type `T`, `true` value would be
455
+ * returned. Otherwise, the parametric value is not following the type `T` or some
456
+ * superfluous property exists, `false` value would be returned.
457
+ *
458
+ * If what you want is not just knowing whether the parametric value is following the
459
+ * type `T` or not, but throwing an exception with detailed reason, you can choose
460
+ * {@link assertEquals} function instead. Also, if you want to know all the errors with
461
+ * detailed reasons, {@link validateEquals} function would be useful.
462
+ *
463
+ * On the other hand, if you want to allow superfluous property that is not enrolled
464
+ * to the type `T`, you can use {@link is} function instead.
465
+ *
466
+ * @template T Type of the input value
467
+ * @param input A value to be tested
468
+ * @returns Whether the parametric value is equivalent to the type `T` or not
469
+ *
470
+ * @author Jeongho Nam - https://github.com/samchon
471
+ */
472
+ function equals<T>(input: T): input is T;
473
+
474
+ /**
475
+ * Tests equality between a value and its type.
476
+ *
477
+ * Tests a parametric value type and returns whether it's equivalent to the type `T`
478
+ * or not. If the parametric value is matched with the type `T` and there's not any
479
+ * superfluous property that is not listed on the type `T`, `true` value would be
480
+ * returned. Otherwise, the parametric value is not following the type `T` or some
481
+ * superfluous property exists, `false` value would be returned.
482
+ *
483
+ * If what you want is not just knowing whether the parametric value is following the
484
+ * type `T` or not, but throwing an exception with detailed reason, you can choose
485
+ * {@link assertEquals} function instead. Also, if you want to know all the errors with
486
+ * detailed reasons, {@link validateEquals} function would be useful.
487
+ *
488
+ * On the other hand, if you want to allow superfluous property that is not enrolled
489
+ * to the type `T`, you can use {@link is} function instead.
490
+ *
491
+ * @template T Type of the input value
492
+ * @param input A value to be tested
493
+ * @returns Whether the parametric value is equivalent to the type `T` or not
494
+ *
495
+ * @author Jeongho Nam - https://github.com/samchon
496
+ */
497
+ function equals<T>(input: unknown): input is T;
498
+
499
+ /**
500
+ * @internal
501
+ */
502
+ function equals(): never {
503
+ halt("equals");
504
+ }
505
+ const equalsPure = /** @__PURE__ */ Object.assign<typeof equals, {}>(
506
+ equals,
507
+ /** @__PURE__ */ Namespace.is(),
508
+ );
509
+ export { equalsPure as equals };
510
+
511
+ /**
512
+ * Validates equality between a value and its type.
513
+ *
514
+ * Validates a parametric value type and archives all the type errors into an
515
+ * {@link IValidation.errors} array, if the parametric value is not following the
516
+ * type `T` or some superfluous property that is not listed on the type `T` has been
517
+ * found. Of course, if the parametric value is following the type `T` and no
518
+ * superfluous property exists, the {@link IValidation.errors} array would be empty
519
+ * and {@link IValidation.success} would have the `true` value.
520
+ *
521
+ * If what you want is not finding all the error, but asserting the parametric value
522
+ * type with exception throwing, you can choose {@link assert} function instead.
523
+ * Otherwise, you just want to know whether the parametric value is matched with the
524
+ * type `T`, {@link is} function is the way to go.
525
+ *
526
+ * On the other and, if you don't want to allow any superfluous property that is not
527
+ * enrolled to the type `T`, you can use {@link validateEquals} function instead.
528
+ *
529
+ * @template Type of the input value
530
+ * @param input A value to be validated
531
+ * @returns Validation result
532
+ *
533
+ * @author Jeongho Nam - https://github.com/samchon
534
+ */
535
+ function validateEquals<T>(input: T): IValidation<T>;
536
+
537
+ /**
538
+ * Validates equality between a value and its type.
539
+ *
540
+ * Validates a parametric value type and archives all the type errors into an
541
+ * {@link IValidation.errors} array, if the parametric value is not following the
542
+ * type `T` or some superfluous property that is not listed on the type `T` has been
543
+ * found. Of course, if the parametric value is following the type `T` and no
544
+ * superfluous property exists, the {@link IValidation.errors} array would be empty
545
+ * and {@link IValidation.success} would have the `true` value.
546
+ *
547
+ * If what you want is not finding all the error, but asserting the parametric value
548
+ * type with exception throwing, you can choose {@link assert} function instead.
549
+ * Otherwise, you just want to know whether the parametric value is matched with the
550
+ * type `T`, {@link is} function is the way to go.
551
+ *
552
+ * On the other and, if you don't want to allow any superfluous property that is not
553
+ * enrolled to the type `T`, you can use {@link validateEquals} function instead.
554
+ *
555
+ * @template Type of the input value
556
+ * @param input A value to be validated
557
+ * @returns Validation result
558
+ *
559
+ * @author Jeongho Nam - https://github.com/samchon
560
+ */
561
+ function validateEquals<T>(input: unknown): IValidation<T>;
562
+
563
+ /**
564
+ * @internal
565
+ */
566
+ function validateEquals(): never {
567
+ halt("validateEquals");
568
+ }
569
+ const validateEqualsPure = /** @__PURE__ */ Object.assign<
570
+ typeof validateEquals,
571
+ {}
572
+ >(validateEquals, /** @__PURE__ */ Namespace.validate());
573
+ export { validateEqualsPure as validateEquals };
574
+
575
+ /* -----------------------------------------------------------
576
+ RANDOM
577
+ ----------------------------------------------------------- */
578
+ /**
579
+ * > You must configure the generic argument `T`.
580
+ *
581
+ * Generate random data.
582
+ *
583
+ * Generates a random data following type the `T`.
584
+ *
585
+ * For reference, this `typia.random()` function generates only primitive type.
586
+ * If there're some methods in the type `T` or its nested instances, those would
587
+ * be ignored. Also, when the type `T` has a `toJSON()` method, its return type
588
+ * would be generated instead.
589
+ *
590
+ * @template T Type of data to generate
591
+ * @param generator Random data generator
592
+ * @return Randomly generated data
593
+ *
594
+ * @author Jeongho Nam - https://github.com/samchon
595
+ */
596
+ function random(generator?: Partial<IRandomGenerator>): never;
597
+
598
+ /**
599
+ * Generate random data.
600
+ *
601
+ * Generates a random data following type the `T`.
602
+ *
603
+ * For reference, this `typia.random()` function generates only primitive type.
604
+ * If there're some methods in the type `T` or its nested instances, those would
605
+ * be ignored. Also, when the type `T` has a `toJSON()` method, its return type
606
+ * would be generated instead.
607
+ *
608
+ * @template T Type of data to generate
609
+ * @param generator Random data generator
610
+ * @return Randomly generated data
611
+ *
612
+ * @author Jeongho Nam - https://github.com/samchon
613
+ */
614
+ function random<T>(generator?: Partial<IRandomGenerator>): Resolved<T>;
615
+
616
+ /**
617
+ * @internal
618
+ */
619
+ function random(): never {
620
+ halt("random");
621
+ }
622
+ const randomPure = /** @__PURE__ */ Object.assign<typeof random, {}>(
623
+ random,
624
+ /** @__PURE__ */ Namespace.random(),
625
+ );
626
+ export { randomPure as random };
627
+
628
+ /* -----------------------------------------------------------
629
+ FACTORY FUNCTIONS
630
+ ----------------------------------------------------------- */
631
+ /**
632
+ * Creates a reusable {@link assert} function.
633
+ *
634
+ * @danger You must configure the generic argument `T`
635
+ * @param errorFactory Custom error factory. Default is `TypeGuardError`
636
+ * @returns Nothing until you configure the generic argument `T`
637
+ * @throws compile error
638
+ *
639
+ * @author Jeongho Nam - https://github.com/samchon
640
+ */
641
+ function createAssert(
642
+ errorFactory?: undefined | ((props: TypeGuardError.IProps) => Error),
643
+ ): never;
644
+
645
+ /**
646
+ * Creates a reusable {@link assert} function.
647
+ *
648
+ * @template T Type of the input value
649
+ * @param errorFactory Custom error factory. Default is `TypeGuardError`
650
+ * @returns A reusable `assert` function
651
+ *
652
+ * @author Jeongho Nam - https://github.com/samchon
653
+ */
654
+ function createAssert<T>(
655
+ errorFactory?: undefined | ((props: TypeGuardError.IProps) => Error),
656
+ ): (input: unknown) => T;
657
+
658
+ /**
659
+ * @internal
660
+ */
661
+ function createAssert<T>(): (input: unknown) => T {
662
+ halt("createAssert");
663
+ }
664
+ const createAssertPure = /** @__PURE__ */ Object.assign<
665
+ typeof createAssert,
666
+ {}
667
+ >(createAssert, assertPure);
668
+ export { createAssertPure as createAssert };
669
+
670
+ /**
671
+ * Creates a reusable {@link assertGuard} function.
672
+ *
673
+ * Note that, you've to declare the variable type of the factory function caller
674
+ * like below. If you don't declare the variable type, compilation error be thrown.
675
+ * This is the special rule of the TypeScript compiler.
676
+ *
677
+ * ```typescript
678
+ * // MUST DECLARE THE VARIABLE TYPE
679
+ * const func: typia.AssertionGuard<number> = typia.createAssertGuard<number>();
680
+ *
681
+ * // IF NOT, COMPILATION ERROR BE OCCURED
682
+ * const func = typia.createAssertGuard<number>();
683
+ * ```
684
+ *
685
+ * > *Assertions require every name in the call target to be declared with an*
686
+ * > *explicit type annotation.*
687
+ *
688
+ * @danger You must configure the generic argument `T`
689
+ * @param errorFactory Custom error factory. Default is `TypeGuardError`
690
+ * @returns Nothing until you configure the generic argument `T`
691
+ * @throws compile error
692
+ *
693
+ * @author Jeongho Nam - https://github.com/samchon
694
+ */
695
+ function createAssertGuard(
696
+ errorFactory?: undefined | ((props: TypeGuardError.IProps) => Error),
697
+ ): never;
698
+
699
+ /**
700
+ * Creates a reusable {@link assertGuard} function.
701
+ *
702
+ * Note that, you've to declare the variable type of the factory function caller
703
+ * like below. If you don't declare the variable type, compilation error be thrown.
704
+ * This is the special rule of the TypeScript compiler.
705
+ *
706
+ * ```typescript
707
+ * // MUST DECLARE THE VARIABLE TYPE
708
+ * const func: typia.AssertionGuard<number> = typia.createAssertGuard<number>();
709
+ *
710
+ * // IF NOT, COMPILATION ERROR BE OCCURED
711
+ * const func = typia.createAssertGuard<number>();
712
+ * ```
713
+ *
714
+ * > *Assertions require every name in the call target to be declared with an*
715
+ * > *explicit type annotation.*
716
+ *
717
+ * @returns Nothing until you configure the generic argument `T`
718
+ * @param errorFactory Custom error factory. Default is `TypeGuardError`
719
+ * @throws compile error
720
+ *
721
+ * @author Jeongho Nam - https://github.com/samchon
722
+ */
723
+ function createAssertGuard<T>(
724
+ errorFactory?: undefined | ((props: TypeGuardError.IProps) => Error),
725
+ ): (input: unknown) => AssertionGuard<T>;
726
+
727
+ /**
728
+ * @internal
729
+ */
730
+ function createAssertGuard<T>(): (input: unknown) => AssertionGuard<T> {
731
+ halt("createAssertGuard");
732
+ }
733
+ const createAssertGuardPure = /** @__PURE__ */ Object.assign<
734
+ typeof createAssertGuard,
735
+ {}
736
+ >(createAssertGuard, assertGuardPure);
737
+ export { createAssertGuardPure as createAssertGuard };
738
+
739
+ /**
740
+ * Creates a reusable {@link is} function.
741
+ *
742
+ * @danger You must configure the generic argument `T`
743
+ * @returns Nothing until you configure the generic argument `T`
744
+ * @throws compile error
745
+ *
746
+ * @author Jeongho Nam - https://github.com/samchon
747
+ */
748
+ function createIs(): never;
749
+
750
+ /**
751
+ * Creates a reusable {@link is} function.
752
+ *
753
+ * @template T Type of the input value
754
+ * @returns A reusable `is` function
755
+ *
756
+ * @author Jeongho Nam - https://github.com/samchon
757
+ */
758
+ function createIs<T>(): (input: unknown) => input is T;
759
+
760
+ /**
761
+ * @internal
762
+ */
763
+ function createIs<T>(): (input: unknown) => input is T {
764
+ halt("createIs");
765
+ }
766
+ const createIsPure = /** @__PURE__ */ Object.assign<typeof createIs, {}>(
767
+ createIs,
768
+ isPure,
769
+ );
770
+ export { createIsPure as createIs };
771
+
772
+ /**
773
+ * Creates a reusable {@link validate} function.
774
+ *
775
+ * @danger You must configure the generic argument `T`
776
+ * @returns Nothing until you configure the generic argument `T`
777
+ * @throws compile error
778
+ *
779
+ * @author Jeongho Nam - https://github.com/samchon
780
+ */
781
+ function createValidate(): never;
782
+
783
+ /**
784
+ * Creates a reusable {@link validate} function.
785
+ *
786
+ * @template T Type of the input value
787
+ * @returns A reusable `validate` function
788
+ *
789
+ * @author Jeongho Nam - https://github.com/samchon
790
+ */
791
+ function createValidate<T>(): (input: unknown) => IValidation<T>;
792
+
793
+ /**
794
+ * @internal
795
+ */
796
+ function createValidate(): (input: unknown) => IValidation {
797
+ halt("createValidate");
798
+ }
799
+ const createValidatePure = /** @__PURE__ */ Object.assign<
800
+ typeof createValidate,
801
+ {}
802
+ >(createValidate, validatePure);
803
+ export { createValidatePure as createValidate };
804
+
805
+ /**
806
+ * Creates a reusable {@link assertEquals} function.
807
+ *
808
+ * @danger You must configure the generic argument `T`
809
+ * @param errorFactory Custom error factory. Default is `TypeGuardError`
810
+ * @returns Nothing until you configure the generic argument `T`
811
+ * @throws compile error
812
+ *
813
+ * @author Jeongho Nam - https://github.com/samchon
814
+ */
815
+ function createAssertEquals(
816
+ errorFactory?: undefined | ((props: TypeGuardError.IProps) => Error),
817
+ ): never;
818
+
819
+ /**
820
+ * Creates a reusable {@link assertEquals} function.
821
+ *
822
+ * @template T Type of the input value
823
+ * @param errorFactory Custom error factory. Default is `TypeGuardError`
824
+ * @returns A reusable `assertEquals` function
825
+ *
826
+ * @author Jeongho Nam - https://github.com/samchon
827
+ */
828
+ function createAssertEquals<T>(
829
+ errorFactory?: undefined | ((props: TypeGuardError.IProps) => Error),
830
+ ): (input: unknown) => T;
831
+
832
+ /**
833
+ * @internal
834
+ */
835
+ function createAssertEquals<T>(): (input: unknown) => T {
836
+ halt("createAssertEquals");
837
+ }
838
+ const createAssertEqualsPure = /** @__PURE__ */ Object.assign<
839
+ typeof createAssertEquals,
840
+ {}
841
+ >(createAssertEquals, assertEqualsPure);
842
+ export { createAssertEqualsPure as createAssertEquals };
843
+
844
+ /**
845
+ * Creates a reusable {@link assertGuardEquals} function.
846
+ *
847
+ * Note that, you've to declare the variable type of the factory function caller
848
+ * like below. If you don't declare the variable type, compilation error be thrown.
849
+ * This is the special rule of the TypeScript compiler.
850
+ *
851
+ * ```typescript
852
+ * // MUST DECLARE THE VARIABLE TYPE
853
+ * const func: typia.AssertionGuard<number> = typia.createAssertGuardEquals<number>();
854
+ *
855
+ * // IF NOT, COMPILATION ERROR BE OCCURED
856
+ * const func = typia.createAssertGuardEquals<number>();
857
+ * ```
858
+ *
859
+ * > *Assertions require every name in the call target to be declared with an*
860
+ * > *explicit type annotation.*
861
+ *
862
+ * @danger You must configure the generic argument `T`
863
+ * @param errorFactory Custom error factory. Default is `TypeGuardError`
864
+ * @returns Nothing until you configure the generic argument `T`
865
+ * @throws compile error
866
+ *
867
+ * @author Jeongho Nam - https://github.com/samchon
868
+ */
869
+ function createAssertGuardEquals(
870
+ errorFactory?: undefined | ((props: TypeGuardError.IProps) => Error),
871
+ ): never;
872
+
873
+ /**
874
+ * Creates a reusable {@link assertGuardEquals} function.
875
+ *
876
+ * Note that, you've to declare the variable type of the factory function caller
877
+ * like below. If you don't declare the variable type, compilation error be thrown.
878
+ * This is the special rule of the TypeScript compiler.
879
+ *
880
+ * ```typescript
881
+ * // MUST DECLARE THE VARIABLE TYPE
882
+ * const func: typia.AssertionGuard<number> = typia.createAssertGuardEquals<number>();
883
+ *
884
+ * // IF NOT, COMPILATION ERROR BE OCCURED
885
+ * const func = typia.createAssertGuardEquals<number>();
886
+ * ```
887
+ *
888
+ * > *Assertions require every name in the call target to be declared with an*
889
+ * > *explicit type annotation.*
890
+ *
891
+ * @param errorFactory Custom error factory. Default is `TypeGuardError`
892
+ * @returns Nothing until you configure the generic argument `T`
893
+ * @throws compile error
894
+ *
895
+ * @author Jeongho Nam - https://github.com/samchon
896
+ */
897
+ function createAssertGuardEquals<T>(
898
+ errorFactory?: undefined | ((props: TypeGuardError.IProps) => Error),
899
+ ): (input: unknown) => AssertionGuard<T>;
900
+
901
+ /**
902
+ * @internal
903
+ */
904
+ function createAssertGuardEquals<T>(): (input: unknown) => AssertionGuard<T> {
905
+ halt("createAssertGuardEquals");
906
+ }
907
+ const createAssertGuardEqualsPure = /** @__PURE__ */ Object.assign<
908
+ typeof createAssertGuardEquals,
909
+ {}
910
+ >(createAssertGuardEquals, assertGuardEqualsPure);
911
+ export { createAssertGuardEqualsPure as createAssertGuardEquals };
912
+
913
+ /**
914
+ * Creates a reusable {@link equals} function.
915
+ *
916
+ * @danger You must configure the generic argument `T`
917
+ * @returns Nothing until you configure the generic argument `T`
918
+ * @throws compile error
919
+ *
920
+ * @author Jeongho Nam - https://github.com/samchon
921
+ */
922
+ function createEquals(): never;
923
+
924
+ /**
925
+ * Creates a reusable {@link equals} function.
926
+ *
927
+ * @template T Type of the input value
928
+ * @returns A reusable `equals` function
929
+ *
930
+ * @author Jeongho Nam - https://github.com/samchon
931
+ */
932
+ function createEquals<T>(): (input: unknown) => input is T;
933
+
934
+ /**
935
+ * @internal
936
+ */
937
+ function createEquals<T>(): (input: unknown) => input is T {
938
+ halt("createEquals");
939
+ }
940
+ const createEqualsPure = /** @__PURE__ */ Object.assign<
941
+ typeof createEquals,
942
+ {}
943
+ >(createEquals, equalsPure);
944
+ export { createEqualsPure as createEquals };
945
+
946
+ /**
947
+ * Creates a reusable {@link validateEquals} function.
948
+ *
949
+ * @danger You must configure the generic argument `T`
950
+ * @returns Nothing until you configure the generic argument `T`
951
+ * @throws compile error
952
+ *
953
+ * @author Jeongho Nam - https://github.com/samchon
954
+ */
955
+ function createValidateEquals(): never;
956
+
957
+ /**
958
+ * Creates a reusable {@link validateEquals} function.
959
+ *
960
+ * @template T Type of the input value
961
+ * @returns A reusable `validateEquals` function
962
+ *
963
+ * @author Jeongho Nam - https://github.com/samchon
964
+ */
965
+ function createValidateEquals<T>(): (input: unknown) => IValidation<T>;
966
+
967
+ /**
968
+ * @internal
969
+ */
970
+ function createValidateEquals(): (input: unknown) => IValidation {
971
+ halt("createValidateEquals");
972
+ }
973
+ const createValidateEqualsPure = /** @__PURE__ */ Object.assign<
974
+ typeof createValidateEquals,
975
+ {}
976
+ >(createValidateEquals, validateEqualsPure);
977
+ export { createValidateEqualsPure as createValidateEquals };
978
+
979
+ /**
980
+ * Creates a reusable {@link random} function.
981
+ *
982
+ * @danger You must configure the generic argument `T`
983
+ * @param generator Random data generator
984
+ * @returns Nothing until you configure the generic argument `T`
985
+ * @throws compile error
986
+ *
987
+ * @author Jeongho Nam - https://github.com/samchon
988
+ */
989
+ function createRandom(generator?: Partial<IRandomGenerator>): never;
990
+
991
+ /**
992
+ * Creates a resuable {@link random} function.
993
+ *
994
+ * @template T Type of the input value
995
+ * @param generator Random data generator
996
+ * @returns A reusable `random` function
997
+ *
998
+ * @author Jeongho Nam - https://github.com/samchon
999
+ */
1000
+ function createRandom<T>(
1001
+ generator?: Partial<IRandomGenerator>,
1002
+ ): () => Resolved<T>;
1003
+
1004
+ /**
1005
+ * @internal
1006
+ */
1007
+ function createRandom(): never {
1008
+ halt("createRandom");
1009
+ }
1010
+ const createRandomPure = /** @__PURE__ */ Object.assign<
1011
+ typeof createRandom,
1012
+ {}
1013
+ >(createRandom, randomPure);
1014
+ export { createRandomPure as createRandom };
1015
+
1016
+ /**
1017
+ * @internal
1018
+ */
1019
+ function halt(name: string): never {
1020
+ throw new Error(
1021
+ `Error on typia.${name}(): no transform has been configured. Read and follow https://typia.io/docs/setup please.`,
1022
+ );
1023
+ }