typia 5.5.7 → 5.5.8

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 (440) hide show
  1. package/lib/executable/TypiaSetupWizard.js.map +1 -1
  2. package/lib/factories/TypeFactory.js.map +1 -1
  3. package/lib/factories/internal/metadata/iterate_metadata.js +1 -1
  4. package/lib/factories/internal/metadata/iterate_metadata.js.map +1 -1
  5. package/lib/factories/internal/metadata/iterate_metadata_intersection.js.map +1 -1
  6. package/lib/factories/internal/metadata/iterate_metadata_sort.js.map +1 -1
  7. package/lib/functional/$FormDataReader/$FormDataReader.js.map +1 -1
  8. package/lib/functional/$HeadersReader/$HeadersReader.js.map +1 -1
  9. package/lib/functional/$ParameterReader/$ParameterReader.js.map +1 -1
  10. package/lib/functional/$ProtobufSizer.js.map +1 -1
  11. package/lib/functional/$QueryReader/$QueryReader.js.map +1 -1
  12. package/lib/programmers/AssertProgrammer.js +3 -1
  13. package/lib/programmers/AssertProgrammer.js.map +1 -1
  14. package/lib/programmers/CheckerProgrammer.js +1 -1
  15. package/lib/programmers/CheckerProgrammer.js.map +1 -1
  16. package/lib/programmers/FeatureProgrammer.js.map +1 -1
  17. package/lib/programmers/RandomProgrammer.js.map +1 -1
  18. package/lib/programmers/TypiaProgrammer.js.map +1 -1
  19. package/lib/programmers/ValidateProgrammer.js +3 -1
  20. package/lib/programmers/ValidateProgrammer.js.map +1 -1
  21. package/lib/programmers/functional/FunctionalIsParametersProgrammer.js +1 -1
  22. package/lib/programmers/functional/FunctionalIsParametersProgrammer.js.map +1 -1
  23. package/lib/programmers/functional/FunctionalIsReturnProgrammer.js +1 -1
  24. package/lib/programmers/functional/FunctionalIsReturnProgrammer.js.map +1 -1
  25. package/lib/programmers/http/HttpFormDataProgrammer.js.map +1 -1
  26. package/lib/programmers/http/HttpHeadersProgrammer.js.map +1 -1
  27. package/lib/programmers/http/HttpQueryProgrammer.js.map +1 -1
  28. package/lib/programmers/internal/application_constant.js.map +1 -1
  29. package/lib/programmers/internal/application_escaped.js.map +1 -1
  30. package/lib/programmers/internal/application_object.js +3 -1
  31. package/lib/programmers/internal/application_object.js.map +1 -1
  32. package/lib/programmers/internal/check_dynamic_key.js.map +1 -1
  33. package/lib/programmers/internal/check_number.js +2 -1
  34. package/lib/programmers/internal/check_number.js.map +1 -1
  35. package/lib/programmers/internal/check_object.js.map +1 -1
  36. package/lib/programmers/internal/feature_object_entries.js.map +1 -1
  37. package/lib/programmers/json/JsonApplicationProgrammer.js.map +1 -1
  38. package/lib/programmers/json/JsonStringifyProgrammer.js.map +1 -1
  39. package/lib/programmers/misc/MiscCloneProgrammer.js.map +1 -1
  40. package/lib/programmers/misc/MiscLiteralsProgrammer.js.map +1 -1
  41. package/lib/programmers/protobuf/ProtobufDecodeProgrammer.js +6 -2
  42. package/lib/programmers/protobuf/ProtobufDecodeProgrammer.js.map +1 -1
  43. package/lib/programmers/protobuf/ProtobufEncodeProgrammer.js.map +1 -1
  44. package/lib/programmers/protobuf/ProtobufMessageProgrammer.js.map +1 -1
  45. package/lib/transformers/features/AssertTransformer.js.map +1 -1
  46. package/lib/transformers/features/CreateAssertTransformer.js.map +1 -1
  47. package/lib/transformers/features/functional/FunctionalGenericTransformer.js +1 -1
  48. package/lib/transformers/features/functional/FunctionalGenericTransformer.js.map +1 -1
  49. package/package.json +2 -2
  50. package/src/AssertionGuard.ts +1 -1
  51. package/src/CamelCase.ts +65 -62
  52. package/src/IRandomGenerator.ts +62 -62
  53. package/src/IValidation.ts +21 -21
  54. package/src/PascalCase.ts +65 -62
  55. package/src/Primitive.ts +48 -47
  56. package/src/Resolved.ts +61 -60
  57. package/src/SnakeCase.ts +67 -64
  58. package/src/TypeGuardError.ts +36 -36
  59. package/src/executable/TypiaGenerateWizard.ts +83 -83
  60. package/src/executable/TypiaPatchWizard.ts +42 -42
  61. package/src/executable/TypiaSetupWizard.ts +4 -4
  62. package/src/executable/setup/ArgumentParser.ts +43 -43
  63. package/src/executable/setup/CommandExecutor.ts +8 -8
  64. package/src/executable/setup/FileRetriever.ts +22 -22
  65. package/src/executable/setup/PackageManager.ts +71 -71
  66. package/src/executable/setup/PluginConfigurator.ts +69 -69
  67. package/src/executable/typia.ts +55 -55
  68. package/src/factories/CommentFactory.ts +79 -79
  69. package/src/factories/ExpressionFactory.ts +150 -150
  70. package/src/factories/IdentifierFactory.ts +70 -70
  71. package/src/factories/JsonMetadataFactory.ts +53 -53
  72. package/src/factories/LiteralFactory.ts +47 -47
  73. package/src/factories/MetadataCollection.ts +260 -260
  74. package/src/factories/MetadataCommentTagFactory.ts +516 -516
  75. package/src/factories/MetadataFactory.ts +267 -267
  76. package/src/factories/MetadataTypeTagFactory.ts +332 -332
  77. package/src/factories/MetadataTypeTagSchemaFactory.ts +58 -58
  78. package/src/factories/NumericRangeFactory.ts +72 -72
  79. package/src/factories/ProtobufFactory.ts +267 -267
  80. package/src/factories/StatementFactory.ts +72 -72
  81. package/src/factories/TemplateFactory.ts +56 -56
  82. package/src/factories/TypeFactory.ts +14 -14
  83. package/src/factories/ValueFactory.ts +12 -12
  84. package/src/factories/internal/metadata/MetadataHelper.ts +15 -15
  85. package/src/factories/internal/metadata/emend_metadata_atomics.ts +46 -46
  86. package/src/factories/internal/metadata/emplace_metadata_alias.ts +41 -41
  87. package/src/factories/internal/metadata/emplace_metadata_array_type.ts +38 -38
  88. package/src/factories/internal/metadata/emplace_metadata_object.ts +176 -176
  89. package/src/factories/internal/metadata/emplace_metadata_tuple.ts +57 -57
  90. package/src/factories/internal/metadata/explore_metadata.ts +28 -28
  91. package/src/factories/internal/metadata/iterate_metadata.ts +1 -1
  92. package/src/factories/internal/metadata/iterate_metadata_alias.ts +34 -34
  93. package/src/factories/internal/metadata/iterate_metadata_array.ts +70 -70
  94. package/src/factories/internal/metadata/iterate_metadata_atomic.ts +62 -62
  95. package/src/factories/internal/metadata/iterate_metadata_coalesce.ts +33 -33
  96. package/src/factories/internal/metadata/iterate_metadata_collection.ts +131 -131
  97. package/src/factories/internal/metadata/iterate_metadata_comment_tags.ts +26 -26
  98. package/src/factories/internal/metadata/iterate_metadata_constant.ts +48 -48
  99. package/src/factories/internal/metadata/iterate_metadata_escape.ts +52 -52
  100. package/src/factories/internal/metadata/iterate_metadata_intersection.ts +2 -2
  101. package/src/factories/internal/metadata/iterate_metadata_map.ts +50 -50
  102. package/src/factories/internal/metadata/iterate_metadata_native.ts +209 -209
  103. package/src/factories/internal/metadata/iterate_metadata_object.ts +33 -33
  104. package/src/factories/internal/metadata/iterate_metadata_set.ts +41 -41
  105. package/src/factories/internal/metadata/iterate_metadata_sort.ts +2 -2
  106. package/src/factories/internal/metadata/iterate_metadata_template.ts +44 -44
  107. package/src/factories/internal/metadata/iterate_metadata_tuple.ts +37 -37
  108. package/src/factories/internal/metadata/iterate_metadata_union.ts +27 -27
  109. package/src/functional/$FormDataReader/$FormDataReader.ts +30 -30
  110. package/src/functional/$FormDataReader/index.ts +1 -1
  111. package/src/functional/$HeadersReader/$HeadersReader.ts +2 -2
  112. package/src/functional/$HeadersReader/index.ts +1 -1
  113. package/src/functional/$ParameterReader/$ParameterReader.ts +2 -2
  114. package/src/functional/$ParameterReader/index.ts +1 -1
  115. package/src/functional/$ProtobufReader.ts +195 -195
  116. package/src/functional/$ProtobufSizer.ts +8 -8
  117. package/src/functional/$ProtobufWriter.ts +150 -150
  118. package/src/functional/$QueryReader/$QueryReader.ts +8 -8
  119. package/src/functional/$QueryReader/index.ts +1 -1
  120. package/src/functional/$any.ts +4 -4
  121. package/src/functional/$clone.ts +4 -4
  122. package/src/functional/$convention.ts +37 -37
  123. package/src/functional/$dictionary.ts +22 -22
  124. package/src/functional/$every.ts +11 -11
  125. package/src/functional/$guard.ts +21 -21
  126. package/src/functional/$is_between.ts +2 -2
  127. package/src/functional/$join.ts +46 -46
  128. package/src/functional/$number.ts +12 -12
  129. package/src/functional/$report.ts +13 -13
  130. package/src/functional/$rest.ts +3 -3
  131. package/src/functional/$stoll.ts +8 -8
  132. package/src/functional/$string.ts +43 -43
  133. package/src/functional/$strlen.ts +7 -7
  134. package/src/functional/$tail.ts +5 -5
  135. package/src/functional/$throws.ts +10 -10
  136. package/src/functional/$varint.ts +130 -130
  137. package/src/functional/$zigzag.ts +39 -39
  138. package/src/functional/IProtobufWriter.ts +18 -18
  139. package/src/functional/Namespace/functional.ts +5 -5
  140. package/src/functional/Namespace/http.ts +9 -9
  141. package/src/functional/Namespace/index.ts +76 -76
  142. package/src/functional/Namespace/json.ts +15 -15
  143. package/src/functional/Namespace/misc.ts +14 -14
  144. package/src/functional/Namespace/notations.ts +23 -23
  145. package/src/functional/Namespace/protobuf.ts +20 -20
  146. package/src/functional/is.ts +10 -10
  147. package/src/functional.ts +872 -872
  148. package/src/http.ts +1266 -1266
  149. package/src/index.ts +4 -4
  150. package/src/json.ts +754 -754
  151. package/src/misc.ts +757 -757
  152. package/src/module.ts +1024 -1024
  153. package/src/notations.ts +1020 -1020
  154. package/src/programmers/AssertProgrammer.ts +40 -38
  155. package/src/programmers/CheckerProgrammer.ts +3 -3
  156. package/src/programmers/FeatureProgrammer.ts +27 -27
  157. package/src/programmers/RandomProgrammer.ts +12 -12
  158. package/src/programmers/TypiaProgrammer.ts +6 -6
  159. package/src/programmers/ValidateProgrammer.ts +40 -38
  160. package/src/programmers/functional/FunctionalAssertFunctionProgrammer.ts +130 -130
  161. package/src/programmers/functional/FunctionalAssertParametersProgrammer.ts +81 -81
  162. package/src/programmers/functional/FunctionalAssertReturnProgrammer.ts +77 -77
  163. package/src/programmers/functional/FunctionalIsFunctionProgrammer.ts +61 -61
  164. package/src/programmers/functional/FunctionalIsParametersProgrammer.ts +1 -1
  165. package/src/programmers/functional/FunctionalIsReturnProgrammer.ts +1 -1
  166. package/src/programmers/functional/FunctionalValidateFunctionProgrammer.ts +113 -113
  167. package/src/programmers/functional/FunctionalValidateParametersProgrammer.ts +203 -203
  168. package/src/programmers/functional/FunctionalValidateReturnProgrammer.ts +107 -107
  169. package/src/programmers/functional/internal/FunctionalGeneralProgrammer.ts +32 -32
  170. package/src/programmers/helpers/AtomicPredicator.ts +24 -24
  171. package/src/programmers/helpers/CloneJoiner.ts +130 -130
  172. package/src/programmers/helpers/FunctionImporeter.ts +1 -1
  173. package/src/programmers/helpers/FunctionImporter.ts +87 -87
  174. package/src/programmers/helpers/HttpMetadataUtil.ts +21 -21
  175. package/src/programmers/helpers/ICheckEntry.ts +13 -13
  176. package/src/programmers/helpers/IExpressionEntry.ts +12 -12
  177. package/src/programmers/helpers/NotationJoiner.ts +132 -132
  178. package/src/programmers/helpers/OptionPredicator.ts +15 -15
  179. package/src/programmers/helpers/ProtobufUtil.ts +125 -125
  180. package/src/programmers/helpers/ProtobufWire.ts +34 -34
  181. package/src/programmers/helpers/PruneJoiner.ts +141 -141
  182. package/src/programmers/helpers/RandomJoiner.ts +140 -140
  183. package/src/programmers/helpers/RandomRanger.ts +171 -171
  184. package/src/programmers/helpers/StringifyJoinder.ts +105 -105
  185. package/src/programmers/helpers/StringifyPredicator.ts +12 -12
  186. package/src/programmers/helpers/UnionExplorer.ts +269 -269
  187. package/src/programmers/helpers/UnionPredicator.ts +77 -77
  188. package/src/programmers/helpers/disable_function_importer_declare.ts +2 -2
  189. package/src/programmers/http/HttpAssertFormDataProgrammer.ts +87 -87
  190. package/src/programmers/http/HttpAssertHeadersProgrammer.ts +89 -89
  191. package/src/programmers/http/HttpAssertQueryProgrammer.ts +87 -87
  192. package/src/programmers/http/HttpFormDataProgrammer.ts +21 -20
  193. package/src/programmers/http/HttpHeadersProgrammer.ts +13 -12
  194. package/src/programmers/http/HttpIsFormDataProgrammer.ts +90 -90
  195. package/src/programmers/http/HttpIsHeadersProgrammer.ts +92 -92
  196. package/src/programmers/http/HttpIsQueryProgrammer.ts +90 -90
  197. package/src/programmers/http/HttpParameterProgrammer.ts +97 -97
  198. package/src/programmers/http/HttpQueryProgrammer.ts +13 -12
  199. package/src/programmers/http/HttpValidateFormDataProgrammer.ts +75 -75
  200. package/src/programmers/http/HttpValidateHeadersProgrammer.ts +77 -77
  201. package/src/programmers/http/HttpValidateQueryProgrammer.ts +75 -75
  202. package/src/programmers/internal/JSON_SCHEMA_PREFIX.ts +1 -1
  203. package/src/programmers/internal/application_alias.ts +74 -74
  204. package/src/programmers/internal/application_array.ts +63 -63
  205. package/src/programmers/internal/application_boolean.ts +44 -44
  206. package/src/programmers/internal/application_constant.ts +4 -4
  207. package/src/programmers/internal/application_default.ts +17 -17
  208. package/src/programmers/internal/application_default_string.ts +33 -33
  209. package/src/programmers/internal/application_escaped.ts +2 -2
  210. package/src/programmers/internal/application_native.ts +40 -40
  211. package/src/programmers/internal/application_number.ts +98 -98
  212. package/src/programmers/internal/application_object.ts +9 -7
  213. package/src/programmers/internal/application_schema.ts +165 -165
  214. package/src/programmers/internal/application_string.ts +65 -65
  215. package/src/programmers/internal/application_templates.ts +24 -24
  216. package/src/programmers/internal/application_tuple.ts +54 -54
  217. package/src/programmers/internal/check_array_length.ts +45 -45
  218. package/src/programmers/internal/check_bigint.ts +49 -49
  219. package/src/programmers/internal/check_dynamic_key.ts +2 -2
  220. package/src/programmers/internal/check_dynamic_properties.ts +211 -211
  221. package/src/programmers/internal/check_everything.ts +23 -23
  222. package/src/programmers/internal/check_native.ts +21 -21
  223. package/src/programmers/internal/check_number.ts +35 -34
  224. package/src/programmers/internal/check_object.ts +5 -4
  225. package/src/programmers/internal/check_string.ts +48 -48
  226. package/src/programmers/internal/check_template.ts +61 -61
  227. package/src/programmers/internal/check_union_array_like.ts +307 -307
  228. package/src/programmers/internal/decode_union_object.ts +99 -99
  229. package/src/programmers/internal/feature_object_entries.ts +8 -8
  230. package/src/programmers/internal/metadata_to_pattern.ts +33 -33
  231. package/src/programmers/internal/prune_object_properties.ts +60 -60
  232. package/src/programmers/internal/random_custom.ts +37 -37
  233. package/src/programmers/internal/stringify_dynamic_properties.ts +157 -157
  234. package/src/programmers/internal/stringify_native.ts +7 -7
  235. package/src/programmers/internal/stringify_regular_properties.ts +81 -81
  236. package/src/programmers/internal/template_to_pattern.ts +15 -15
  237. package/src/programmers/internal/wrap_metadata_rest_tuple.ts +20 -20
  238. package/src/programmers/json/JsonApplicationProgrammer.ts +1 -1
  239. package/src/programmers/json/JsonAssertParseProgrammer.ts +81 -81
  240. package/src/programmers/json/JsonAssertStringifyProgrammer.ts +67 -67
  241. package/src/programmers/json/JsonIsParseProgrammer.ts +81 -81
  242. package/src/programmers/json/JsonIsStringifyProgrammer.ts +75 -75
  243. package/src/programmers/json/JsonStringifyProgrammer.ts +15 -11
  244. package/src/programmers/json/JsonValidateParseProgrammer.ts +64 -64
  245. package/src/programmers/json/JsonValidateStringifyProgrammer.ts +83 -83
  246. package/src/programmers/misc/MiscAssertCloneProgrammer.ts +77 -77
  247. package/src/programmers/misc/MiscAssertPruneProgrammer.ts +66 -66
  248. package/src/programmers/misc/MiscCloneProgrammer.ts +8 -8
  249. package/src/programmers/misc/MiscIsCloneProgrammer.ts +78 -78
  250. package/src/programmers/misc/MiscIsPruneProgrammer.ts +66 -66
  251. package/src/programmers/misc/MiscLiteralsProgrammer.ts +8 -8
  252. package/src/programmers/misc/MiscPruneProgrammer.ts +523 -523
  253. package/src/programmers/misc/MiscValidateCloneProgrammer.ts +80 -80
  254. package/src/programmers/misc/MiscValidatePruneProgrammer.ts +73 -73
  255. package/src/programmers/notations/NotationAssertGeneralProgrammer.ts +70 -70
  256. package/src/programmers/notations/NotationGeneralProgrammer.ts +647 -647
  257. package/src/programmers/notations/NotationIsGeneralProgrammer.ts +71 -71
  258. package/src/programmers/notations/NotationValidateGeneralProgrammer.ts +81 -81
  259. package/src/programmers/protobuf/ProtobufAssertDecodeProgrammer.ts +87 -87
  260. package/src/programmers/protobuf/ProtobufAssertEncodeProgrammer.ts +67 -67
  261. package/src/programmers/protobuf/ProtobufDecodeProgrammer.ts +35 -31
  262. package/src/programmers/protobuf/ProtobufEncodeProgrammer.ts +46 -46
  263. package/src/programmers/protobuf/ProtobufIsDecodeProgrammer.ts +90 -90
  264. package/src/programmers/protobuf/ProtobufIsEncodeProgrammer.ts +75 -75
  265. package/src/programmers/protobuf/ProtobufMessageProgrammer.ts +2 -2
  266. package/src/programmers/protobuf/ProtobufValidateDecodeProgrammer.ts +75 -75
  267. package/src/programmers/protobuf/ProtobufValidateEncodeProgrammer.ts +83 -83
  268. package/src/protobuf.ts +999 -999
  269. package/src/reflect.ts +57 -57
  270. package/src/schemas/json/IJsonApplication.ts +9 -9
  271. package/src/schemas/json/IJsonComponents.ts +19 -19
  272. package/src/schemas/json/IJsonSchema.ts +147 -147
  273. package/src/schemas/metadata/IJsDocTagInfo.ts +10 -10
  274. package/src/schemas/metadata/IMetadata.ts +34 -34
  275. package/src/schemas/metadata/IMetadataAlias.ts +12 -12
  276. package/src/schemas/metadata/IMetadataApplication.ts +7 -7
  277. package/src/schemas/metadata/IMetadataArray.ts +7 -7
  278. package/src/schemas/metadata/IMetadataArrayType.ts +10 -10
  279. package/src/schemas/metadata/IMetadataAtomic.ts +6 -6
  280. package/src/schemas/metadata/IMetadataComponents.ts +11 -11
  281. package/src/schemas/metadata/IMetadataConstant.ts +23 -23
  282. package/src/schemas/metadata/IMetadataDictionary.ts +11 -11
  283. package/src/schemas/metadata/IMetadataEntry.ts +6 -6
  284. package/src/schemas/metadata/IMetadataEscaped.ts +6 -6
  285. package/src/schemas/metadata/IMetadataObject.ts +13 -13
  286. package/src/schemas/metadata/IMetadataProperty.ts +9 -9
  287. package/src/schemas/metadata/IMetadataTuple.ts +7 -7
  288. package/src/schemas/metadata/IMetadataTupleType.ts +10 -10
  289. package/src/schemas/metadata/IMetadataTypeTag.ts +16 -16
  290. package/src/schemas/metadata/Metadata.ts +631 -631
  291. package/src/schemas/metadata/MetadataAlias.ts +61 -61
  292. package/src/schemas/metadata/MetadataApplication.ts +44 -44
  293. package/src/schemas/metadata/MetadataArray.ts +49 -49
  294. package/src/schemas/metadata/MetadataArrayType.ts +57 -57
  295. package/src/schemas/metadata/MetadataAtomic.ts +85 -85
  296. package/src/schemas/metadata/MetadataComponents.ts +98 -98
  297. package/src/schemas/metadata/MetadataConstant.ts +46 -46
  298. package/src/schemas/metadata/MetadataEscaped.ts +51 -51
  299. package/src/schemas/metadata/MetadataObject.ts +154 -154
  300. package/src/schemas/metadata/MetadataProperty.ts +56 -56
  301. package/src/schemas/metadata/MetadataTuple.ts +32 -32
  302. package/src/schemas/metadata/MetadataTupleType.ts +67 -67
  303. package/src/tags/Default.ts +18 -18
  304. package/src/tags/ExclusiveMaximum.ts +19 -19
  305. package/src/tags/ExclusiveMinimum.ts +19 -19
  306. package/src/tags/Format.ts +16 -16
  307. package/src/tags/MaxItems.ts +12 -12
  308. package/src/tags/MaxLength.ts +12 -12
  309. package/src/tags/Maximum.ts +18 -18
  310. package/src/tags/MinItems.ts +12 -12
  311. package/src/tags/MinLength.ts +12 -12
  312. package/src/tags/Minimum.ts +18 -18
  313. package/src/tags/MultipleOf.ts +20 -20
  314. package/src/tags/Pattern.ts +12 -12
  315. package/src/tags/TagBase.ts +76 -76
  316. package/src/tags/Type.ts +14 -14
  317. package/src/tags/index.ts +14 -14
  318. package/src/tags/internal/FormatCheatSheet.ts +71 -71
  319. package/src/transform.ts +35 -35
  320. package/src/transformers/CallExpressionTransformer.ts +496 -496
  321. package/src/transformers/FileTransformer.ts +91 -91
  322. package/src/transformers/IProject.ts +15 -15
  323. package/src/transformers/ITransformOptions.ts +62 -62
  324. package/src/transformers/ImportTransformer.ts +66 -66
  325. package/src/transformers/NodeTransformer.ts +13 -13
  326. package/src/transformers/TransformerError.ts +55 -55
  327. package/src/transformers/features/AssertTransformer.ts +2 -2
  328. package/src/transformers/features/CreateAssertTransformer.ts +2 -2
  329. package/src/transformers/features/CreateIsTransformer.ts +10 -10
  330. package/src/transformers/features/CreateRandomTransformer.ts +40 -40
  331. package/src/transformers/features/CreateValidateTransformer.ts +13 -13
  332. package/src/transformers/features/IsTransformer.ts +10 -10
  333. package/src/transformers/features/RandomTransformer.ts +44 -44
  334. package/src/transformers/features/ValidateTransformer.ts +11 -11
  335. package/src/transformers/features/functional/FunctionalGenericTransformer.ts +3 -1
  336. package/src/transformers/features/http/CreateHttpAssertFormDataTransformer.ts +12 -12
  337. package/src/transformers/features/http/CreateHttpAssertHeadersTransformer.ts +11 -11
  338. package/src/transformers/features/http/CreateHttpAssertQueryTransformer.ts +9 -9
  339. package/src/transformers/features/http/CreateHttpFormDataTransformer.ts +9 -9
  340. package/src/transformers/features/http/CreateHttpHeadersTransformer.ts +9 -9
  341. package/src/transformers/features/http/CreateHttpIsFormDataTransformer.ts +9 -9
  342. package/src/transformers/features/http/CreateHttpIsHeadersTransformer.ts +9 -9
  343. package/src/transformers/features/http/CreateHttpIsQueryTransformer.ts +9 -9
  344. package/src/transformers/features/http/CreateHttpParameterTransformer.ts +9 -9
  345. package/src/transformers/features/http/CreateHttpQueryTransformer.ts +9 -9
  346. package/src/transformers/features/http/CreateHttpValidateFormDataTransformer.ts +12 -12
  347. package/src/transformers/features/http/CreateHttpValidateHeadersTransformer.ts +12 -12
  348. package/src/transformers/features/http/CreateHttpValidateQueryTransformer.ts +11 -11
  349. package/src/transformers/features/http/HttpAssertFormDataTransformer.ts +10 -10
  350. package/src/transformers/features/http/HttpAssertHeadersTransformer.ts +9 -9
  351. package/src/transformers/features/http/HttpAssertQueryTransformer.ts +9 -9
  352. package/src/transformers/features/http/HttpFormDataTransformer.ts +9 -9
  353. package/src/transformers/features/http/HttpHeadersTransformer.ts +9 -9
  354. package/src/transformers/features/http/HttpIsFormDataTransformer.ts +9 -9
  355. package/src/transformers/features/http/HttpIsHeadersTransformer.ts +9 -9
  356. package/src/transformers/features/http/HttpIsQueryTransformer.ts +9 -9
  357. package/src/transformers/features/http/HttpParameterTransformer.ts +9 -9
  358. package/src/transformers/features/http/HttpQueryTransformer.ts +9 -9
  359. package/src/transformers/features/http/HttpValidateFormDataTransformer.ts +10 -10
  360. package/src/transformers/features/http/HttpValidateHeadersTransformer.ts +10 -10
  361. package/src/transformers/features/http/HttpValidateQueryTransformer.ts +9 -9
  362. package/src/transformers/features/json/JsonApplicationTransformer.ts +133 -133
  363. package/src/transformers/features/json/JsonAssertParseTransformer.ts +9 -9
  364. package/src/transformers/features/json/JsonAssertStringifyTransformer.ts +10 -10
  365. package/src/transformers/features/json/JsonCreateAssertParseTransformer.ts +9 -9
  366. package/src/transformers/features/json/JsonCreateAssertStringifyTransformer.ts +12 -12
  367. package/src/transformers/features/json/JsonCreateIsParseTransformer.ts +9 -9
  368. package/src/transformers/features/json/JsonCreateIsStringifyTransformer.ts +9 -9
  369. package/src/transformers/features/json/JsonCreateStringifyTransformer.ts +9 -9
  370. package/src/transformers/features/json/JsonCreateValidateParseTransformer.ts +11 -11
  371. package/src/transformers/features/json/JsonCreateValidateStringifyProgrammer.ts +12 -12
  372. package/src/transformers/features/json/JsonIsParseTransformer.ts +9 -9
  373. package/src/transformers/features/json/JsonIsStringifyTransformer.ts +9 -9
  374. package/src/transformers/features/json/JsonStringifyTransformer.ts +9 -9
  375. package/src/transformers/features/json/JsonValidateParseTransformer.ts +9 -9
  376. package/src/transformers/features/json/JsonValidateStringifyTransformer.ts +10 -10
  377. package/src/transformers/features/misc/MiscAssertCloneTransformer.ts +9 -9
  378. package/src/transformers/features/misc/MiscAssertPruneTransformer.ts +9 -9
  379. package/src/transformers/features/misc/MiscCloneTransformer.ts +9 -9
  380. package/src/transformers/features/misc/MiscCreateAssertCloneTransformer.ts +9 -9
  381. package/src/transformers/features/misc/MiscCreateAssertPruneTransformer.ts +9 -9
  382. package/src/transformers/features/misc/MiscCreateCloneTransformer.ts +9 -9
  383. package/src/transformers/features/misc/MiscCreateIsCloneTransformer.ts +9 -9
  384. package/src/transformers/features/misc/MiscCreateIsPruneTransformer.ts +9 -9
  385. package/src/transformers/features/misc/MiscCreatePruneTransformer.ts +9 -9
  386. package/src/transformers/features/misc/MiscCreateValidateCloneTransformer.ts +11 -11
  387. package/src/transformers/features/misc/MiscCreateValidatePruneTransformer.ts +11 -11
  388. package/src/transformers/features/misc/MiscIsCloneTransformer.ts +9 -9
  389. package/src/transformers/features/misc/MiscIsPruneTransformer.ts +9 -9
  390. package/src/transformers/features/misc/MiscLiteralsTransformer.ts +32 -32
  391. package/src/transformers/features/misc/MiscPruneTransformer.ts +9 -9
  392. package/src/transformers/features/misc/MiscValidateCloneTransformer.ts +9 -9
  393. package/src/transformers/features/misc/MiscValidatePruneTransformer.ts +9 -9
  394. package/src/transformers/features/notations/NotationAssertGeneralTransformer.ts +15 -15
  395. package/src/transformers/features/notations/NotationCreateAssertGeneralTransformer.ts +15 -15
  396. package/src/transformers/features/notations/NotationCreateGeneralTransformer.ts +15 -15
  397. package/src/transformers/features/notations/NotationCreateIsGeneralTransformer.ts +15 -15
  398. package/src/transformers/features/notations/NotationCreateValidateGeneralTransformer.ts +15 -15
  399. package/src/transformers/features/notations/NotationGeneralTransformer.ts +11 -11
  400. package/src/transformers/features/notations/NotationIsGeneralTransformer.ts +15 -15
  401. package/src/transformers/features/notations/NotationValidateGeneralTransformer.ts +15 -15
  402. package/src/transformers/features/protobuf/ProtobufAssertDecodeTransformer.ts +10 -10
  403. package/src/transformers/features/protobuf/ProtobufAssertEncodeTransformer.ts +10 -10
  404. package/src/transformers/features/protobuf/ProtobufCreateAssertDecodeTransformer.ts +12 -12
  405. package/src/transformers/features/protobuf/ProtobufCreateAssertEncodeTransformer.ts +12 -12
  406. package/src/transformers/features/protobuf/ProtobufCreateDecodeTransformer.ts +9 -9
  407. package/src/transformers/features/protobuf/ProtobufCreateEncodeTransformer.ts +9 -9
  408. package/src/transformers/features/protobuf/ProtobufCreateIsDecodeTransformer.ts +9 -9
  409. package/src/transformers/features/protobuf/ProtobufCreateIsEncodeTransformer.ts +9 -9
  410. package/src/transformers/features/protobuf/ProtobufCreateValidateDecodeTransformer.ts +12 -12
  411. package/src/transformers/features/protobuf/ProtobufCreateValidateEncodeTransformer.ts +12 -12
  412. package/src/transformers/features/protobuf/ProtobufDecodeTransformer.ts +9 -9
  413. package/src/transformers/features/protobuf/ProtobufEncodeTransformer.ts +9 -9
  414. package/src/transformers/features/protobuf/ProtobufIsDecodeTransformer.ts +9 -9
  415. package/src/transformers/features/protobuf/ProtobufIsEncodeTransformer.ts +9 -9
  416. package/src/transformers/features/protobuf/ProtobufMessageTransformer.ts +33 -33
  417. package/src/transformers/features/protobuf/ProtobufValidateDecodeTransformer.ts +10 -10
  418. package/src/transformers/features/protobuf/ProtobufValidateEncodeTransformer.ts +10 -10
  419. package/src/transformers/features/reflect/ReflectMetadataTransformer.ts +63 -63
  420. package/src/transformers/internal/GenericTransformer.ts +104 -104
  421. package/src/typings/Atomic.ts +13 -13
  422. package/src/typings/ClassProperties.ts +5 -5
  423. package/src/typings/Customizable.ts +5 -5
  424. package/src/typings/OmitNever.ts +3 -3
  425. package/src/typings/ProtobufAtomic.ts +19 -19
  426. package/src/typings/SpecialFields.ts +3 -3
  427. package/src/typings/ValidationPipe.ts +9 -9
  428. package/src/typings/Writable.ts +11 -11
  429. package/src/utils/ArrayUtil.ts +43 -43
  430. package/src/utils/Escaper.ts +46 -46
  431. package/src/utils/MapUtil.ts +12 -12
  432. package/src/utils/NameEncoder.ts +32 -32
  433. package/src/utils/NamingConvention/NamingConvention.ts +86 -86
  434. package/src/utils/NamingConvention/index.ts +1 -1
  435. package/src/utils/PatternUtil.ts +29 -29
  436. package/src/utils/RandomGenerator/RandomGenerator.ts +105 -105
  437. package/src/utils/RandomGenerator/index.ts +1 -1
  438. package/src/utils/Singleton.ts +16 -16
  439. package/src/utils/StringUtil/StringUtil.ts +7 -7
  440. package/src/utils/StringUtil/index.ts +1 -1
package/src/functional.ts CHANGED
@@ -1,872 +1,872 @@
1
- import * as Namespace from "./functional/Namespace";
2
-
3
- import { IValidation } from "./IValidation";
4
- import { TypeGuardError } from "./TypeGuardError";
5
-
6
- /* ===========================================================
7
- FUNCTIONAL
8
- - ASSERT
9
- - IS
10
- - VALIDATE
11
- ==============================================================
12
- ASSERT
13
- ----------------------------------------------------------- */
14
- /**
15
- * Asserts a function.
16
- *
17
- * Asserts a function, by wrapping the function and checking its parameters and
18
- * return value through {@link assert} function. If some parameter or return value
19
- * does not match the expected type, it throws an {@link TypeGuardError} or a custom
20
- * error generated by the *errorFactory* parameter.
21
- *
22
- * For reference, {@link TypeGuardError.path} would be a little bit different with
23
- * individual {@link assert} function. If the {@link TypeGuardError} occurs from
24
- * some parameter, the path would start from `$input.parameters[number]`. Otherwise
25
- * the path would start from `$input.return`.
26
- *
27
- * - `$input.parameters[0].~`
28
- * - `$input.return.~`
29
- *
30
- * By the way, if what you want is not just finding the 1st type error through
31
- * assertion, but also finding every type errors, then use {@link validateFunction}
32
- * instead. Otherwise, what you want is just asserting parameters or return value
33
- * only, you can use {@link assertParameters} or {@link assertReturn} instead.
34
- *
35
- * On the other hand, if don't want to allow any superfluous properties, utilize
36
- * {@link assertEqualsFunction} or {@link validateEqualsFunction} instead.
37
- *
38
- * @template T Target function type
39
- * @param func Target function to assert
40
- * @param errorFactory Custom error factory. Default is `TypeGuardError`
41
- * @returns The wrapper function with type assertions
42
- * @throws A {@link TypeGuardError} or a custom error generated by *errorFactory*
43
- *
44
- * @author Jeongho Nam - https://github.com/samchon
45
- */
46
- function assertFunction<T extends (...args: any[]) => any>(
47
- func: T,
48
- errorFactory?: undefined | ((props: TypeGuardError.IProps) => Error),
49
- ): T;
50
-
51
- /**
52
- * @internal
53
- */
54
- function assertFunction(): never {
55
- halt("assertFunction");
56
- }
57
- const assertFunctionPure = /** @__PURE__ */ Object.assign<
58
- typeof assertFunction,
59
- {},
60
- {}
61
- >(
62
- assertFunction,
63
- /** @__PURE__ */ Namespace.assert("functional.assertFunction"),
64
- /** @__PURE__ */ Namespace.functional.functionalAssert(),
65
- );
66
- export { assertFunctionPure as assertFunction };
67
-
68
- /**
69
- * Asserts parameters.
70
- *
71
- * Asserts a function, by wrapping the function and checking its parameters through
72
- * {@link assert} function. If some parameter does not match the expected type, it
73
- * throws an {@link TypeGuardError} or a custom error generated by the *errorFactory*
74
- * parameter.
75
- *
76
- * For reference, {@link TypeGuardError.path} would be a little bit different with
77
- * individual {@link assert} function. If the {@link TypeGuardError} occurs from
78
- * some parameter, the path would start from `$input.parameters[number]`.
79
- *
80
- * By the way, if what you want is not just finding the 1st type error through
81
- * assertion, but also finding every type errors, then use {@link validateParameters}
82
- * instead. Otherwise, what you want is not only asserting parameters, but also
83
- * asserting return value, you can use {@link assertFunction} instead.
84
- *
85
- * On the other hand, if don't want to allow any superfluous properties, utilize
86
- * {@link assertEqualsParameters} or {@link validateEqualsParameters} instead.
87
- *
88
- * @template T Target function type
89
- * @param func Target function to assert
90
- * @param errorFactory Custom error factory. Default is `TypeGuardError`
91
- * @returns The wrapper function with type assertions
92
- * @throws A {@link TypeGuardError} or a custom error generated by *errorFactory*
93
- *
94
- * @author Jeongho Nam - https://github.com/samchon
95
- */
96
- function assertParameters<T extends (...args: any[]) => any>(
97
- func: T,
98
- errorFactory?: undefined | ((props: TypeGuardError.IProps) => Error),
99
- ): T;
100
-
101
- /**
102
- * @internal
103
- */
104
- function assertParameters(): never {
105
- halt("assertParameters");
106
- }
107
- const assertParametersPure = /** @__PURE__ */ Object.assign<
108
- typeof assertParameters,
109
- {},
110
- {}
111
- >(
112
- assertFunction,
113
- /** @__PURE__ */ Namespace.assert("functional.assertFunction"),
114
- /** @__PURE__ */ Namespace.functional.functionalAssert(),
115
- );
116
- export { assertParametersPure as assertParameters };
117
-
118
- /**
119
- * Asserts return value.
120
- *
121
- * Asserts a function, by wrapping the function and checking its return value through
122
- * {@link assert} function. If the return value does not match the expected type, it
123
- * throws an {@link TypeGuardError} or a custom error generated by the *errorFactory*
124
- * parameter.
125
- *
126
- * For reference, {@link TypeGuardError.path} would be a little bit different with
127
- * individual {@link assert} function. If the {@link TypeGuardError} occurs from
128
- * the return value, the path would start from `$input.return`.
129
- *
130
- * By the way, if what you want is not just finding the 1st type error through
131
- * assertion, but also finding every type errors, then use {@link validateReturn}
132
- * instead. Otherwise, what you want is not only asserting return value, but also
133
- * asserting parameters, you can use {@link assertFunction} instead.
134
- *
135
- * On the other hand, if don't want to allow any superfluous properties, utilize
136
- * {@link assertEqualsReturn} or {@link validateEqualsReturn} instead.
137
- *
138
- * @template T Target function type
139
- * @param func Target function to assert
140
- * @param errorFactory Custom error factory. Default is `TypeGuardError`
141
- * @returns The wrapper function with type assertions
142
- * @throws A {@link TypeGuardError} or a custom error generated by *errorFactory*
143
- *
144
- * @author Jeongho Nam - https://github.com/samchon
145
- */
146
- function assertReturn<T extends (...args: any[]) => any>(
147
- func: T,
148
- errorFactory?: undefined | ((props: TypeGuardError.IProps) => Error),
149
- ): T;
150
-
151
- /**
152
- * @internal
153
- */
154
- function assertReturn(): never {
155
- halt("assertReturn");
156
- }
157
- const assertReturnPure = /** @__PURE__ */ Object.assign<
158
- typeof assertReturn,
159
- {},
160
- {}
161
- >(
162
- assertReturn,
163
- /** @__PURE__ */ Namespace.assert("functional.assertReturn"),
164
- /** @__PURE__ */ Namespace.functional.functionalAssert(),
165
- );
166
- export { assertReturnPure as assertReturn };
167
-
168
- /**
169
- * Asserts a function with strict equality.
170
- *
171
- * Asserts a function with strict equality, by wrapping the function and checking
172
- * its parameters and return value through {@link assertEquals} function. If some
173
- * parameter or return value does not match the expected type, it throws an
174
- * {@link TypeGuardError} or a custom error generated by the *errorFactory* parameter.
175
- *
176
- * For reference, {@link TypeGuardError.path} would be a little bit different with
177
- * individual {@link assertEquals} function. If the {@link TypeGuardError} occurs from
178
- * some parameter, the path would start from `$input.parameters[number]`. Otherwise
179
- * the path would start from `$input.return`.
180
- *
181
- * - `$input.parameters[0].~`
182
- * - `$input.return.~`
183
- *
184
- * By the way, if what you want is not just finding the 1st type error through
185
- * assertion, but also finding every type errors, then use
186
- * {@link validateEqualsFunction} instead. Otherwise, what you want is just asserting
187
- * parameters or return value only, you can use {@link assertEqualsParameters} or
188
- * {@link assertEqualsReturn} instead.
189
- *
190
- * On the other hand, if you want to allow any superfluous properties, utilize
191
- * {@link assertFunction} or {@link validateFunction} instead.
192
- *
193
- * @template T Target function type
194
- * @param func Target function to assert
195
- * @param errorFactory Custom error factory. Default is `TypeGuardError`
196
- * @returns The wrapper function with type assertions
197
- * @throws A {@link TypeGuardError} or a custom error generated by *errorFactory*
198
- *
199
- * @author Jeongho Nam - https://github.com/samchon
200
- */
201
- function assertEqualsFunction<T extends (...args: any[]) => any>(
202
- func: T,
203
- errorFactory?: undefined | ((props: TypeGuardError.IProps) => Error),
204
- ): T;
205
-
206
- /**
207
- * @internal
208
- */
209
- function assertEqualsFunction(): never {
210
- halt("assertEqualsFunction");
211
- }
212
- const assertEqualsFunctionPure = /** @__PURE__ */ Object.assign<
213
- typeof assertEqualsFunction,
214
- {},
215
- {}
216
- >(
217
- assertEqualsFunction,
218
- /** @__PURE__ */ Namespace.assert("functional.assertEqualsFunction"),
219
- /** @__PURE__ */ Namespace.functional.functionalAssert(),
220
- );
221
- export { assertEqualsFunctionPure as assertEqualsFunction };
222
-
223
- /**
224
- * Asserts parameters with strict equality.
225
- *
226
- * Asserts a function, by wrapping the function and checking its parameters through
227
- * {@link assertEquals} function. If some parameter does not match the expected type,
228
- * it throws an {@link TypeGuardError} or a custom error generated by the *errorFactory*
229
- * parameter.
230
- *
231
- * For reference, {@link TypeGuardError.path} would be a little bit different with
232
- * individual {@link assertEquals} function. If the {@link TypeGuardError} occurs from
233
- * some parameter, the path would start from `$input.parameters[number]`.
234
- *
235
- * By the way, if what you want is not just finding the 1st type error through
236
- * assertion, but also finding every type errors, then use
237
- * {@link validateEqualsParameters} instead. Otherwise, what you want is not only
238
- * asserting parameters, but also asserting return value, you can use
239
- * {@link assertEqualsFunction} instead.
240
- *
241
- * On the other hand, if you want to allow any superfluous properties, utilize
242
- * {@link assertParameters} or {@link validateParameters} instead.
243
- *
244
- * @template T Target function type
245
- * @param func Target function to assert
246
- * @param errorFactory Custom error factory. Default is `TypeGuardError`
247
- * @returns The wrapper function with type assertions
248
- * @throws A {@link TypeGuardError} or a custom error generated by *errorFactory*
249
- *
250
- * @author Jeongho Nam - https://github.com/samchon
251
- */
252
- function assertEqualsParameters<T extends (...args: any[]) => any>(
253
- func: T,
254
- errorFactory?: undefined | ((props: TypeGuardError.IProps) => Error),
255
- ): T;
256
-
257
- /**
258
- * @internal
259
- */
260
- function assertEqualsParameters(): never {
261
- halt("assertEqualsParameters");
262
- }
263
- const assertEqualsParametersPure = /** @__PURE__ */ Object.assign<
264
- typeof assertEqualsParameters,
265
- {},
266
- {}
267
- >(
268
- assertEqualsParameters,
269
- /** @__PURE__ */ Namespace.assert("functional.assertEqualsParameters"),
270
- /** @__PURE__ */ Namespace.functional.functionalAssert(),
271
- );
272
- export { assertEqualsParametersPure as assertEqualsParameters };
273
-
274
- /**
275
- * Asserts return value with strict equality.
276
- *
277
- * Asserts a function, by wrapping the function and checking its return value through
278
- * {@link assertEquals} function. If the return value does not match the expected type,
279
- * it throws an {@link TypeGuardError} or a custom error generated by the *errorFactory*
280
- * parameter.
281
- *
282
- * For reference, {@link TypeGuardError.path} would be a little bit different with
283
- * individual {@link assertEquals} function. If the {@link TypeGuardError} occurs from
284
- * the return value, the path would start from `$input.return`.
285
- *
286
- * By the way, if what you want is not just finding the 1st type error through
287
- * assertion, but also finding every type errors, then use {@link validateEqualsReturn}
288
- * instead. Otherwise, what you want is not only asserting return value, but also
289
- * asserting parameters, you can use {@link assertEqualsFunction} instead.
290
- *
291
- * On the other hand, if you want to allow any superfluous properties, utilize
292
- * {@link assertReturn} or {@link validateReturn} instead.
293
- *
294
- * @template T Target function type
295
- * @param func Target function to assert
296
- * @param errorFactory Custom error factory. Default is `TypeGuardError`
297
- * @returns The wrapper function with type assertions
298
- * @throws A {@link TypeGuardError} or a custom error generated by *errorFactory*
299
- *
300
- * @author Jeongho Nam - https://github.com/samchon
301
- */
302
- function assertEqualsReturn<T extends (...args: any[]) => any>(
303
- func: T,
304
- errorFactory?: undefined | ((props: TypeGuardError.IProps) => Error),
305
- ): T;
306
-
307
- /**
308
- * @internal
309
- */
310
- function assertEqualsReturn(): never {
311
- halt("assertEqualsReturn");
312
- }
313
- const assertEqualsReturnPure = /** @__PURE__ */ Object.assign<
314
- typeof assertEqualsReturn,
315
- {},
316
- {}
317
- >(
318
- assertEqualsReturn,
319
- /** @__PURE__ */ Namespace.assert("functional.assertEqualsReturn"),
320
- /** @__PURE__ */ Namespace.functional.functionalAssert(),
321
- );
322
- export { assertEqualsReturnPure as assertEqualsReturn };
323
-
324
- /* -----------------------------------------------------------
325
- IS
326
- ----------------------------------------------------------- */
327
- /**
328
- * Tests a function.
329
- *
330
- * Tests a function, by wrapping the function and checking its parameters and
331
- * return value through {@link is} function. If some parameter or return value
332
- * does not match the expected type, it returns `null`. Otherwise there's no
333
- * type error, it returns the result of the function.
334
- *
335
- * By the way, if you want is not just testing type checking, but also finding
336
- * detailed type error reason(s), then use {@link assertFunction} or
337
- * {@link validateFunction} instead.
338
- *
339
- * On the other hand, if you don't want to allow any superfluous properties,
340
- * utilize {@link equalsFunction}, {@link assertEqualsFunction} or
341
- * {@link validateEqualsFunction} instead.
342
- *
343
- * @template T Target function type
344
- * @param func Target function to test
345
- * @returns The wrapper function with type tests
346
- *
347
- * @author Jeongho Nam - https://github.com/samchon
348
- */
349
- function isFunction<T extends (...args: any[]) => any>(
350
- func: T,
351
- ): T extends (...args: infer Arguments) => infer Output
352
- ? Output extends Promise<infer R>
353
- ? (...args: Arguments) => Promise<R | null>
354
- : (...args: Arguments) => Output | null
355
- : never;
356
-
357
- /**
358
- * @internal
359
- */
360
- function isFunction(): never {
361
- halt("isFunction");
362
- }
363
- const isFunctionPure = /** @__PURE__ */ Object.assign<typeof isFunction, {}>(
364
- isFunction,
365
- /** @__PURE__ */ Namespace.is(),
366
- );
367
- export { isFunctionPure as isFunction };
368
-
369
- /**
370
- * Tests parameters.
371
- *
372
- * Tests a function, by wrapping the function and checking its parameters through
373
- * {@link is} function. If some parameter does not match the expected type, it
374
- * returns `null`. Otherwise there's no type error, it returns the result of the
375
- * function.
376
- *
377
- * By the way, if you want is not just testing type checking, but also finding
378
- * detailed type error reason(s), then use {@link assertParameters} or
379
- * {@link validateParameters} instead.
380
- *
381
- * On the other hand, if you don't want to allow any superfluous properties,
382
- * utilize {@link equalsParameters}, {@link assertEqualsParameters} or
383
- * {@link validateEqualsParameters} instead.
384
- *
385
- * @template T Target function type
386
- * @param func Target function to test
387
- * @returns The wrapper function with type tests
388
- *
389
- * @author Jeongho Nam - https://github.com/samchon
390
- */
391
- function isParameters<T extends (...args: any[]) => any>(
392
- func: T,
393
- ): T extends (...args: infer Arguments) => infer Output
394
- ? Output extends Promise<infer R>
395
- ? (...args: Arguments) => Promise<R | null>
396
- : (...args: Arguments) => Output | null
397
- : never;
398
-
399
- /**
400
- * @internal
401
- */
402
- function isParameters(): never {
403
- halt("isParameters");
404
- }
405
- const isParametersPure = /** @__PURE__ */ Object.assign<
406
- typeof isParameters,
407
- {}
408
- >(isParameters, /** @__PURE__ */ Namespace.is());
409
- export { isParametersPure as isParameters };
410
-
411
- /**
412
- * Tests return value.
413
- *
414
- * Tests a function, by wrapping the function and checking its return value through
415
- * {@link is} function. If the return value does not match the expected type, it
416
- * returns `null`. Otherwise there's no type error, it returns the result of the
417
- * function.
418
- *
419
- * By the way, if you want is not just testing type checking, but also finding
420
- * detailed type error reason(s), then use {@link assertReturn} or
421
- * {@link validateReturn} instead.
422
- *
423
- * On the other hand, if you don't want to allow any superfluous properties,
424
- * utilize {@link equalsReturn}, {@link assertEqualsReturn} or
425
- * {@link validateEqualsReturn} instead.
426
- *
427
- * @template T Target function type
428
- * @param func Target function to test
429
- * @returns The wrapper function with type tests
430
- *
431
- * @author Jeongho Nam - https://github.com/samchon
432
- */
433
- function isReturn<T extends (...args: any[]) => any>(
434
- func: T,
435
- ): T extends (...args: infer Arguments) => infer Output
436
- ? Output extends Promise<infer R>
437
- ? (...args: Arguments) => Promise<R | null>
438
- : (...args: Arguments) => Output | null
439
- : never;
440
-
441
- /**
442
- * @internal
443
- */
444
- function isReturn(): never {
445
- halt("isReturn");
446
- }
447
- const isReturnPure = /** @__PURE__ */ Object.assign<typeof isReturn, {}>(
448
- isReturn,
449
- /** @__PURE__ */ Namespace.is(),
450
- );
451
- export { isReturnPure as isReturn };
452
-
453
- /**
454
- * Tests a function with strict equality.
455
- *
456
- * Tests a function with strict equality, by wrapping the function and checking its
457
- * parameters and return value through {@link isEquals} function. If some parameter
458
- * or return value does not match the expected type, it returns `null`. Otherwise
459
- * there's no type error, it returns the result of the function.
460
- *
461
- * By the way, if you want is not just testing type checking, but also finding
462
- * detailed type error reason(s), then use {@link assertEqualsFunction} or
463
- * {@link validateEqualsFunction} instead.
464
- *
465
- * On the other hand, if you want to allow any superfluous properties, utilize
466
- * {@link isFunction}, {@link assertFunction} or {@link validateFunction} instead.
467
- *
468
- * @template T Target function type
469
- * @param func Target function to test
470
- * @returns The wrapper function with type tests
471
- *
472
- * @author Jeongho Nam - https://github.com/samchon
473
- */
474
- function equalsFunction<T extends (...args: any[]) => any>(
475
- func: T,
476
- ): T extends (...args: infer Arguments) => infer Output
477
- ? Output extends Promise<infer R>
478
- ? (...args: Arguments) => Promise<R | null>
479
- : (...args: Arguments) => Output | null
480
- : never;
481
-
482
- /**
483
- * @internal
484
- */
485
- function equalsFunction(): never {
486
- halt("equalsFunction");
487
- }
488
- const equalsFunctionPure = /** @__PURE__ */ Object.assign<
489
- typeof equalsFunction,
490
- {}
491
- >(equalsFunction, /** @__PURE__ */ Namespace.is());
492
- export { equalsFunctionPure as equalsFunction };
493
-
494
- /**
495
- * Tests parameters with strict equality.
496
- *
497
- * Tests a function, by wrapping the function and checking its parameters through
498
- * {@link isEquals} function. If some parameter does not match the expected type,
499
- * it returns `null`. Otherwise there's no type error, it returns the result of the
500
- * function.
501
- *
502
- * By the way, if you want is not just testing type checking, but also finding
503
- * detailed type error reason(s), then use {@link assertEqualsParameters} or
504
- * {@link validateEqualsParameters} instead.
505
- *
506
- * @template T Target function type
507
- * @param func Target function to test
508
- * @returns The wrapper function with type tests
509
- *
510
- * @author Jeongho Nam - https://github.com/samchon
511
- */
512
- function equalsParameters<T extends (...args: any[]) => any>(
513
- func: T,
514
- ): T extends (...args: infer Arguments) => infer Output
515
- ? Output extends Promise<infer R>
516
- ? (...args: Arguments) => Promise<R | null>
517
- : (...args: Arguments) => Output | null
518
- : never;
519
-
520
- /**
521
- * @internal
522
- */
523
- function equalsParameters(): never {
524
- halt("equalsParameters");
525
- }
526
- const equalsParametersPure = /** @__PURE__ */ Object.assign<
527
- typeof equalsParameters,
528
- {}
529
- >(equalsParameters, /** @__PURE__ */ Namespace.is());
530
- export { equalsParametersPure as equalsParameters };
531
-
532
- /**
533
- * Tests return value with strict equality.
534
- *
535
- * Tests a function, by wrapping the function and checking its return value through
536
- * {@link isEquals} function. If the return value does not match the expected type,
537
- * it returns `null`. Otherwise there's no type error, it returns the result of the
538
- * function.
539
- *
540
- * By the way, if you want is not just testing type checking, but also finding
541
- * detailed type error reason(s), then use {@link assertEqualsReturn} or
542
- * {@link validateEqualsReturn} instead.
543
- *
544
- * On the other hand, if you want to allow any superfluous properties, utilize
545
- * {@link isReturn}, {@link assertReturn} or {@link validateReturn} instead.
546
- *
547
- * @template T Target function type
548
- * @param func Target function to test
549
- * @returns The wrapper function with type tests
550
- *
551
- * @author Jeongho Nam - https://github.com/samchon
552
- */
553
- function equalsReturn<T extends (...args: any[]) => any>(
554
- func: T,
555
- ): T extends (...args: infer Arguments) => infer Output
556
- ? Output extends Promise<infer R>
557
- ? (...args: Arguments) => Promise<R | null>
558
- : (...args: Arguments) => Output | null
559
- : never;
560
-
561
- /**
562
- * @internal
563
- */
564
- function equalsReturn(): never {
565
- halt("equalsReturn");
566
- }
567
- const equalsReturnPure = /** @__PURE__ */ Object.assign<
568
- typeof equalsReturn,
569
- {}
570
- >(equalsReturn, /** @__PURE__ */ Namespace.is());
571
- export { equalsReturnPure as equalsReturn };
572
-
573
- /* -----------------------------------------------------------
574
- VALIDATE
575
- ----------------------------------------------------------- */
576
- /**
577
- * Validates a function.
578
- *
579
- * Validates a function, by wrapping the function and checking its parameters and
580
- * return value through {@link validate} function. If some parameter or return value
581
- * does not match the expected type, it returns {@link IValidation.IError} typed
582
- * object. Otherwise there's no type error, it returns {@link IValidation.ISuccess}
583
- * typed object instead.
584
- *
585
- * For reference, {@link IValidation.IError.path} would be a little bit different with
586
- * individual {@link validate} function. If the {@link IValidation.IError} occurs from
587
- * some parameter, the path would start from `$input.parameters[number]`. Otherwise
588
- * the path would start from `$input.return`.
589
- *
590
- * - `$input.parameters[0].~`
591
- * - `$input.return.~`
592
- *
593
- * By the way, if what you want is not finding every type errors, but just finding
594
- * the 1st type error, then use {@link assertFunction} instead. Otherwise, what you
595
- * want is just validating parameters or return value only, you can use
596
- * {@link validateParameters} or {@link validateReturn} instead.
597
- *
598
- * On the other hand, if you don't want to allow any superfluous properties, utilize
599
- * {@link validateEqualsFunction} or {@link assertEqualsFunction} instead.
600
- *
601
- * @template T Target function type
602
- * @param func Target function to validate
603
- * @returns The wrapper function with type validations
604
- *
605
- * @author Jeongho Nam - https://github.com/samchon
606
- */
607
- function validateFunction<T extends (...args: any[]) => any>(
608
- func: T,
609
- ): T extends (...args: infer Arguments) => infer Output
610
- ? Output extends Promise<infer R>
611
- ? (...args: Arguments) => Promise<IValidation<R>>
612
- : (...args: Arguments) => IValidation<Output>
613
- : never;
614
-
615
- /**
616
- * @internal
617
- */
618
- function validateFunction(): never {
619
- halt("validateFunction");
620
- }
621
- const validateFunctionPure = /** @__PURE__ */ Object.assign<
622
- typeof validateFunction,
623
- {}
624
- >(validateFunction, /** @__PURE__ */ Namespace.validate());
625
- export { validateFunctionPure as validateFunction };
626
-
627
- /**
628
- * Validates parameters.
629
- *
630
- * Validates a function, by wrapping the function and checking its parameters through
631
- * {@link validate} function. If some parameter does not match the expected type, it
632
- * returns {@link IValidation.IError} typed object. Otherwise there's no type error,
633
- * it returns {@link IValidation.ISuccess} typed object instead.
634
- *
635
- * For reference, {@link IValidation.IError.path} would be a little bit different with
636
- * individual {@link validate} function. If the {@link IValidation.IError} occurs from
637
- * some parameter, the path would start from `$input.parameters[number]`.
638
- *
639
- * By the way, if what you want is not finding every type errors, but just finding
640
- * the 1st type error, then use {@link assertParameters} instead. Otherwise, what you
641
- * want is not only validating parameters, but also validating return value, you can
642
- * use {@link validateFunction} instead.
643
- *
644
- * On the other hand, if you don't want to allow any superfluous properties, utilize
645
- * {@link validateEqualsParameters} or {@link assertEqualsParameters} instead.
646
- *
647
- * @template T Target function type
648
- * @param func Target function to validate
649
- * @returns The wrapper function with type validations
650
- *
651
- * @author Jeongho Nam - https://github.com/samchon
652
- */
653
- function validateParameters<T extends (...args: any[]) => any>(
654
- func: T,
655
- ): T extends (...args: infer Arguments) => infer Output
656
- ? Output extends Promise<infer R>
657
- ? (...args: Arguments) => Promise<IValidation<R>>
658
- : (...args: Arguments) => IValidation<Output>
659
- : never;
660
-
661
- /**
662
- * @internal
663
- */
664
- function validateParameters(): never {
665
- halt("validateReturn");
666
- }
667
- const validateParametersPure = /** @__PURE__ */ Object.assign<
668
- typeof validateParameters,
669
- {}
670
- >(validateParameters, /** @__PURE__ */ Namespace.validate());
671
- export { validateParametersPure as validateParameters };
672
-
673
- /**
674
- * Validates return value.
675
- *
676
- * Validates a function, by wrapping the function and checking its return value through
677
- * {@link validate} function. If the return value does not match the expected type, it
678
- * returns {@link IValidation.IError} typed object. Otherwise there's no type error,
679
- * it returns {@link IValidation.ISuccess} typed object instead.
680
- *
681
- * For reference, {@link IValidation.IError.path} would be a little bit different with
682
- * individual {@link validate} function. If the {@link IValidation.IError} occurs from
683
- * the return value, the path would start from `$input.return`.
684
- *
685
- * By the way, if what you want is not finding every type errors, but just finding
686
- * the 1st type error, then use {@link assertReturn} instead. Otherwise, what you want
687
- * is not only validating return value, but also validating parameters, you can use
688
- * {@link validateFunction} instead.
689
- *
690
- * On the other hand, if you don't want to allow any superfluous properties, utilize
691
- * {@link validateEqualsReturn} or {@link assertEqualsReturn} instead.
692
- *
693
- * @template T Target function type
694
- * @param func Target function to validate
695
- * @returns The wrapper function with type validations
696
- *
697
- * @author Jeongho Nam - https://github.com/samchon
698
- */
699
- function validateReturn<T extends (...args: any[]) => any>(
700
- func: T,
701
- ): T extends (...args: infer Arguments) => infer Output
702
- ? Output extends Promise<infer R>
703
- ? (...args: Arguments) => Promise<IValidation<R>>
704
- : (...args: Arguments) => IValidation<Output>
705
- : never;
706
-
707
- /**
708
- * @internal
709
- */
710
- function validateReturn(): never {
711
- halt("validateReturn");
712
- }
713
- const validateReturnPure = /** @__PURE__ */ Object.assign<
714
- typeof validateReturn,
715
- {}
716
- >(validateReturn, /** @__PURE__ */ Namespace.validate());
717
- export { validateReturnPure as validateReturn };
718
-
719
- /**
720
- * Validates a function with strict equality.
721
- *
722
- * Validates a function with strict equality, by wrapping the function and checking
723
- * its parameters and return value through {@link validateEquals} function. If some
724
- * parameter or return value does not match the expected type, it returns
725
- * {@link IValidation.IError} typed object. Otherwise there's no type error, it
726
- * returns {@link IValidation.ISuccess} typed object instead.
727
- *
728
- * For reference, {@link IValidation.IError.path} would be a little bit different with
729
- * individual {@link validateEquals} function. If the {@link IValidation.IError} occurs
730
- * from some parameter, the path would start from `$input.parameters[number]`. Otherwise
731
- * the path would start from `$input.return`.
732
- *
733
- * - `$input.parameters[0].~`
734
- * - `$input.return.~`
735
- *
736
- * By the way, if what you want is not finding every type errors, but just finding
737
- * the 1st type error, then use {@link assertEqualsFunction} instead. Otherwise, what
738
- * you want is just validating parameters or return value only, you can use
739
- * {@link validateEqualsParameters} or {@link validateEqualsReturn} instead.
740
- *
741
- * On the other hand, if you want to allow any superfluous properties, utilize
742
- * {@link validateFunction} or {@link assertFunction} instead.
743
- *
744
- * @template T Target function type
745
- * @param func Target function to validate
746
- * @returns The wrapper function with type validations
747
- *
748
- * @author Jeongho Nam - https://github.com/samchon
749
- */
750
- function validateEqualsFunction<T extends (...args: any[]) => any>(
751
- func: T,
752
- ): T extends (...args: infer Arguments) => infer Output
753
- ? Output extends Promise<infer R>
754
- ? (...args: Arguments) => Promise<IValidation<R>>
755
- : (...args: Arguments) => IValidation<Output>
756
- : never;
757
-
758
- /**
759
- * @internal
760
- */
761
- function validateEqualsFunction(): never {
762
- halt("validateEqualsFunction");
763
- }
764
- const validateEqualsFunctionPure = /** @__PURE__ */ Object.assign<
765
- typeof validateEqualsFunction,
766
- {}
767
- >(validateEqualsFunction, /** @__PURE__ */ Namespace.validate());
768
- export { validateEqualsFunctionPure as validateEqualsFunction };
769
-
770
- /**
771
- * Validates parameters with strict equality.
772
- *
773
- * Validates a function, by wrapping the function and checking its parameters through
774
- * {@link validateEquals} function. If some parameter does not match the expected type,
775
- * it returns {@link IValidation.IError} typed object. Otherwise there's no type error,
776
- * it returns {@link IValidation.ISuccess} typed object instead.
777
- *
778
- * For reference, {@link IValidation.IError.path} would be a little bit different with
779
- * individual {@link validateEquals} function. If the {@link IValidation.IError} occurs
780
- * from some parameter, the path would start from `$input.parameters[number]`.
781
- *
782
- * By the way, if what you want is not finding every type errors, but just finding
783
- * the 1st type error, then use {@link assertEqualsParameters} instead. Otherwise,
784
- * what you want is not only validating parameters, but also validating return value,
785
- * you can use {@link validateEqualsFunction} instead.
786
- *
787
- * On the other hand, if you want to allow any superfluous properties, utilize
788
- * {@link validateParameters} or {@link assertParameters} instead.
789
- *
790
- * @template T Target function type
791
- * @param func Target function to validate
792
- * @returns The wrapper function with type validations
793
- *
794
- * @author Jeongho Nam - https://github.com/samchon
795
- */
796
- function validateEqualsParameters<T extends (...args: any[]) => any>(
797
- func: T,
798
- ): T extends (...args: infer Arguments) => infer Output
799
- ? Output extends Promise<infer R>
800
- ? (...args: Arguments) => Promise<IValidation<R>>
801
- : (...args: Arguments) => IValidation<Output>
802
- : never;
803
-
804
- /**
805
- * @internal
806
- */
807
- function validateEqualsParameters(): never {
808
- halt("validateEqualsParameters");
809
- }
810
- const validateEqualsParametersPure = /** @__PURE__ */ Object.assign<
811
- typeof validateEqualsParameters,
812
- {}
813
- >(validateEqualsParameters, /** @__PURE__ */ Namespace.validate());
814
- export { validateEqualsParametersPure as validateEqualsParameters };
815
-
816
- /**
817
- * Validates return value with strict equality.
818
- *
819
- * Validates a function, by wrapping the function and checking its return value through
820
- * {@link validateEquals} function. If the return value does not match the expected type,
821
- * it returns {@link IValidation.IError} typed object. Otherwise there's no type error,
822
- * it returns {@link IValidation.ISuccess} typed object instead.
823
- *
824
- * For reference, {@link IValidation.IError.path} would be a little bit different with
825
- * individual {@link validateEquals} function. If the {@link IValidation.IError} occurs
826
- * from the return value, the path would start from `$input.return`.
827
- *
828
- * By the way, if what you want is not finding every type errors, but just finding
829
- * the 1st type error, then use {@link assertEqualsReturn} instead. Otherwise, what you
830
- * want is not only validating return value, but also validating parameters, you can use
831
- * {@link validateEqualsFunction} instead.
832
- *
833
- * On the other hand, if you want to allow any superfluous properties, utilize
834
- * {@link validateReturn} or {@link assertReturn} instead.
835
- *
836
- * @template T Target function type
837
- * @param func Target function to validate
838
- * @returns The wrapper function with type validations
839
- *
840
- * @author Jeongho Nam - https://github.com/samchon
841
- */
842
- function validateEqualsReturn<T extends (...args: any[]) => any>(
843
- func: T,
844
- ): T extends (...args: infer Arguments) => infer Output
845
- ? Output extends Promise<infer R>
846
- ? (...args: Arguments) => Promise<IValidation<R>>
847
- : (...args: Arguments) => IValidation<Output>
848
- : never;
849
-
850
- /**
851
- * @internal
852
- */
853
- function validateEqualsReturn(): never {
854
- halt("validateEqualsReturn");
855
- }
856
- const validateEqualsReturnPure = /** @__PURE__ */ Object.assign<
857
- typeof validateEqualsReturn,
858
- {}
859
- >(validateEqualsReturn, /** @__PURE__ */ Namespace.validate());
860
- export { validateEqualsReturnPure as validateEqualsReturn };
861
-
862
- /* -----------------------------------------------------------
863
- HALTER
864
- ----------------------------------------------------------- */
865
- /**
866
- * @internal
867
- */
868
- function halt(name: string): never {
869
- throw new Error(
870
- `Error on typia.functional.${name}(): no transform has been configured. Read and follow https://typia.io/docs/setup please.`,
871
- );
872
- }
1
+ import * as Namespace from "./functional/Namespace";
2
+
3
+ import { IValidation } from "./IValidation";
4
+ import { TypeGuardError } from "./TypeGuardError";
5
+
6
+ /* ===========================================================
7
+ FUNCTIONAL
8
+ - ASSERT
9
+ - IS
10
+ - VALIDATE
11
+ ==============================================================
12
+ ASSERT
13
+ ----------------------------------------------------------- */
14
+ /**
15
+ * Asserts a function.
16
+ *
17
+ * Asserts a function, by wrapping the function and checking its parameters and
18
+ * return value through {@link assert} function. If some parameter or return value
19
+ * does not match the expected type, it throws an {@link TypeGuardError} or a custom
20
+ * error generated by the *errorFactory* parameter.
21
+ *
22
+ * For reference, {@link TypeGuardError.path} would be a little bit different with
23
+ * individual {@link assert} function. If the {@link TypeGuardError} occurs from
24
+ * some parameter, the path would start from `$input.parameters[number]`. Otherwise
25
+ * the path would start from `$input.return`.
26
+ *
27
+ * - `$input.parameters[0].~`
28
+ * - `$input.return.~`
29
+ *
30
+ * By the way, if what you want is not just finding the 1st type error through
31
+ * assertion, but also finding every type errors, then use {@link validateFunction}
32
+ * instead. Otherwise, what you want is just asserting parameters or return value
33
+ * only, you can use {@link assertParameters} or {@link assertReturn} instead.
34
+ *
35
+ * On the other hand, if don't want to allow any superfluous properties, utilize
36
+ * {@link assertEqualsFunction} or {@link validateEqualsFunction} instead.
37
+ *
38
+ * @template T Target function type
39
+ * @param func Target function to assert
40
+ * @param errorFactory Custom error factory. Default is `TypeGuardError`
41
+ * @returns The wrapper function with type assertions
42
+ * @throws A {@link TypeGuardError} or a custom error generated by *errorFactory*
43
+ *
44
+ * @author Jeongho Nam - https://github.com/samchon
45
+ */
46
+ function assertFunction<T extends (...args: any[]) => any>(
47
+ func: T,
48
+ errorFactory?: undefined | ((props: TypeGuardError.IProps) => Error),
49
+ ): T;
50
+
51
+ /**
52
+ * @internal
53
+ */
54
+ function assertFunction(): never {
55
+ halt("assertFunction");
56
+ }
57
+ const assertFunctionPure = /** @__PURE__ */ Object.assign<
58
+ typeof assertFunction,
59
+ {},
60
+ {}
61
+ >(
62
+ assertFunction,
63
+ /** @__PURE__ */ Namespace.assert("functional.assertFunction"),
64
+ /** @__PURE__ */ Namespace.functional.functionalAssert(),
65
+ );
66
+ export { assertFunctionPure as assertFunction };
67
+
68
+ /**
69
+ * Asserts parameters.
70
+ *
71
+ * Asserts a function, by wrapping the function and checking its parameters through
72
+ * {@link assert} function. If some parameter does not match the expected type, it
73
+ * throws an {@link TypeGuardError} or a custom error generated by the *errorFactory*
74
+ * parameter.
75
+ *
76
+ * For reference, {@link TypeGuardError.path} would be a little bit different with
77
+ * individual {@link assert} function. If the {@link TypeGuardError} occurs from
78
+ * some parameter, the path would start from `$input.parameters[number]`.
79
+ *
80
+ * By the way, if what you want is not just finding the 1st type error through
81
+ * assertion, but also finding every type errors, then use {@link validateParameters}
82
+ * instead. Otherwise, what you want is not only asserting parameters, but also
83
+ * asserting return value, you can use {@link assertFunction} instead.
84
+ *
85
+ * On the other hand, if don't want to allow any superfluous properties, utilize
86
+ * {@link assertEqualsParameters} or {@link validateEqualsParameters} instead.
87
+ *
88
+ * @template T Target function type
89
+ * @param func Target function to assert
90
+ * @param errorFactory Custom error factory. Default is `TypeGuardError`
91
+ * @returns The wrapper function with type assertions
92
+ * @throws A {@link TypeGuardError} or a custom error generated by *errorFactory*
93
+ *
94
+ * @author Jeongho Nam - https://github.com/samchon
95
+ */
96
+ function assertParameters<T extends (...args: any[]) => any>(
97
+ func: T,
98
+ errorFactory?: undefined | ((props: TypeGuardError.IProps) => Error),
99
+ ): T;
100
+
101
+ /**
102
+ * @internal
103
+ */
104
+ function assertParameters(): never {
105
+ halt("assertParameters");
106
+ }
107
+ const assertParametersPure = /** @__PURE__ */ Object.assign<
108
+ typeof assertParameters,
109
+ {},
110
+ {}
111
+ >(
112
+ assertFunction,
113
+ /** @__PURE__ */ Namespace.assert("functional.assertFunction"),
114
+ /** @__PURE__ */ Namespace.functional.functionalAssert(),
115
+ );
116
+ export { assertParametersPure as assertParameters };
117
+
118
+ /**
119
+ * Asserts return value.
120
+ *
121
+ * Asserts a function, by wrapping the function and checking its return value through
122
+ * {@link assert} function. If the return value does not match the expected type, it
123
+ * throws an {@link TypeGuardError} or a custom error generated by the *errorFactory*
124
+ * parameter.
125
+ *
126
+ * For reference, {@link TypeGuardError.path} would be a little bit different with
127
+ * individual {@link assert} function. If the {@link TypeGuardError} occurs from
128
+ * the return value, the path would start from `$input.return`.
129
+ *
130
+ * By the way, if what you want is not just finding the 1st type error through
131
+ * assertion, but also finding every type errors, then use {@link validateReturn}
132
+ * instead. Otherwise, what you want is not only asserting return value, but also
133
+ * asserting parameters, you can use {@link assertFunction} instead.
134
+ *
135
+ * On the other hand, if don't want to allow any superfluous properties, utilize
136
+ * {@link assertEqualsReturn} or {@link validateEqualsReturn} instead.
137
+ *
138
+ * @template T Target function type
139
+ * @param func Target function to assert
140
+ * @param errorFactory Custom error factory. Default is `TypeGuardError`
141
+ * @returns The wrapper function with type assertions
142
+ * @throws A {@link TypeGuardError} or a custom error generated by *errorFactory*
143
+ *
144
+ * @author Jeongho Nam - https://github.com/samchon
145
+ */
146
+ function assertReturn<T extends (...args: any[]) => any>(
147
+ func: T,
148
+ errorFactory?: undefined | ((props: TypeGuardError.IProps) => Error),
149
+ ): T;
150
+
151
+ /**
152
+ * @internal
153
+ */
154
+ function assertReturn(): never {
155
+ halt("assertReturn");
156
+ }
157
+ const assertReturnPure = /** @__PURE__ */ Object.assign<
158
+ typeof assertReturn,
159
+ {},
160
+ {}
161
+ >(
162
+ assertReturn,
163
+ /** @__PURE__ */ Namespace.assert("functional.assertReturn"),
164
+ /** @__PURE__ */ Namespace.functional.functionalAssert(),
165
+ );
166
+ export { assertReturnPure as assertReturn };
167
+
168
+ /**
169
+ * Asserts a function with strict equality.
170
+ *
171
+ * Asserts a function with strict equality, by wrapping the function and checking
172
+ * its parameters and return value through {@link assertEquals} function. If some
173
+ * parameter or return value does not match the expected type, it throws an
174
+ * {@link TypeGuardError} or a custom error generated by the *errorFactory* parameter.
175
+ *
176
+ * For reference, {@link TypeGuardError.path} would be a little bit different with
177
+ * individual {@link assertEquals} function. If the {@link TypeGuardError} occurs from
178
+ * some parameter, the path would start from `$input.parameters[number]`. Otherwise
179
+ * the path would start from `$input.return`.
180
+ *
181
+ * - `$input.parameters[0].~`
182
+ * - `$input.return.~`
183
+ *
184
+ * By the way, if what you want is not just finding the 1st type error through
185
+ * assertion, but also finding every type errors, then use
186
+ * {@link validateEqualsFunction} instead. Otherwise, what you want is just asserting
187
+ * parameters or return value only, you can use {@link assertEqualsParameters} or
188
+ * {@link assertEqualsReturn} instead.
189
+ *
190
+ * On the other hand, if you want to allow any superfluous properties, utilize
191
+ * {@link assertFunction} or {@link validateFunction} instead.
192
+ *
193
+ * @template T Target function type
194
+ * @param func Target function to assert
195
+ * @param errorFactory Custom error factory. Default is `TypeGuardError`
196
+ * @returns The wrapper function with type assertions
197
+ * @throws A {@link TypeGuardError} or a custom error generated by *errorFactory*
198
+ *
199
+ * @author Jeongho Nam - https://github.com/samchon
200
+ */
201
+ function assertEqualsFunction<T extends (...args: any[]) => any>(
202
+ func: T,
203
+ errorFactory?: undefined | ((props: TypeGuardError.IProps) => Error),
204
+ ): T;
205
+
206
+ /**
207
+ * @internal
208
+ */
209
+ function assertEqualsFunction(): never {
210
+ halt("assertEqualsFunction");
211
+ }
212
+ const assertEqualsFunctionPure = /** @__PURE__ */ Object.assign<
213
+ typeof assertEqualsFunction,
214
+ {},
215
+ {}
216
+ >(
217
+ assertEqualsFunction,
218
+ /** @__PURE__ */ Namespace.assert("functional.assertEqualsFunction"),
219
+ /** @__PURE__ */ Namespace.functional.functionalAssert(),
220
+ );
221
+ export { assertEqualsFunctionPure as assertEqualsFunction };
222
+
223
+ /**
224
+ * Asserts parameters with strict equality.
225
+ *
226
+ * Asserts a function, by wrapping the function and checking its parameters through
227
+ * {@link assertEquals} function. If some parameter does not match the expected type,
228
+ * it throws an {@link TypeGuardError} or a custom error generated by the *errorFactory*
229
+ * parameter.
230
+ *
231
+ * For reference, {@link TypeGuardError.path} would be a little bit different with
232
+ * individual {@link assertEquals} function. If the {@link TypeGuardError} occurs from
233
+ * some parameter, the path would start from `$input.parameters[number]`.
234
+ *
235
+ * By the way, if what you want is not just finding the 1st type error through
236
+ * assertion, but also finding every type errors, then use
237
+ * {@link validateEqualsParameters} instead. Otherwise, what you want is not only
238
+ * asserting parameters, but also asserting return value, you can use
239
+ * {@link assertEqualsFunction} instead.
240
+ *
241
+ * On the other hand, if you want to allow any superfluous properties, utilize
242
+ * {@link assertParameters} or {@link validateParameters} instead.
243
+ *
244
+ * @template T Target function type
245
+ * @param func Target function to assert
246
+ * @param errorFactory Custom error factory. Default is `TypeGuardError`
247
+ * @returns The wrapper function with type assertions
248
+ * @throws A {@link TypeGuardError} or a custom error generated by *errorFactory*
249
+ *
250
+ * @author Jeongho Nam - https://github.com/samchon
251
+ */
252
+ function assertEqualsParameters<T extends (...args: any[]) => any>(
253
+ func: T,
254
+ errorFactory?: undefined | ((props: TypeGuardError.IProps) => Error),
255
+ ): T;
256
+
257
+ /**
258
+ * @internal
259
+ */
260
+ function assertEqualsParameters(): never {
261
+ halt("assertEqualsParameters");
262
+ }
263
+ const assertEqualsParametersPure = /** @__PURE__ */ Object.assign<
264
+ typeof assertEqualsParameters,
265
+ {},
266
+ {}
267
+ >(
268
+ assertEqualsParameters,
269
+ /** @__PURE__ */ Namespace.assert("functional.assertEqualsParameters"),
270
+ /** @__PURE__ */ Namespace.functional.functionalAssert(),
271
+ );
272
+ export { assertEqualsParametersPure as assertEqualsParameters };
273
+
274
+ /**
275
+ * Asserts return value with strict equality.
276
+ *
277
+ * Asserts a function, by wrapping the function and checking its return value through
278
+ * {@link assertEquals} function. If the return value does not match the expected type,
279
+ * it throws an {@link TypeGuardError} or a custom error generated by the *errorFactory*
280
+ * parameter.
281
+ *
282
+ * For reference, {@link TypeGuardError.path} would be a little bit different with
283
+ * individual {@link assertEquals} function. If the {@link TypeGuardError} occurs from
284
+ * the return value, the path would start from `$input.return`.
285
+ *
286
+ * By the way, if what you want is not just finding the 1st type error through
287
+ * assertion, but also finding every type errors, then use {@link validateEqualsReturn}
288
+ * instead. Otherwise, what you want is not only asserting return value, but also
289
+ * asserting parameters, you can use {@link assertEqualsFunction} instead.
290
+ *
291
+ * On the other hand, if you want to allow any superfluous properties, utilize
292
+ * {@link assertReturn} or {@link validateReturn} instead.
293
+ *
294
+ * @template T Target function type
295
+ * @param func Target function to assert
296
+ * @param errorFactory Custom error factory. Default is `TypeGuardError`
297
+ * @returns The wrapper function with type assertions
298
+ * @throws A {@link TypeGuardError} or a custom error generated by *errorFactory*
299
+ *
300
+ * @author Jeongho Nam - https://github.com/samchon
301
+ */
302
+ function assertEqualsReturn<T extends (...args: any[]) => any>(
303
+ func: T,
304
+ errorFactory?: undefined | ((props: TypeGuardError.IProps) => Error),
305
+ ): T;
306
+
307
+ /**
308
+ * @internal
309
+ */
310
+ function assertEqualsReturn(): never {
311
+ halt("assertEqualsReturn");
312
+ }
313
+ const assertEqualsReturnPure = /** @__PURE__ */ Object.assign<
314
+ typeof assertEqualsReturn,
315
+ {},
316
+ {}
317
+ >(
318
+ assertEqualsReturn,
319
+ /** @__PURE__ */ Namespace.assert("functional.assertEqualsReturn"),
320
+ /** @__PURE__ */ Namespace.functional.functionalAssert(),
321
+ );
322
+ export { assertEqualsReturnPure as assertEqualsReturn };
323
+
324
+ /* -----------------------------------------------------------
325
+ IS
326
+ ----------------------------------------------------------- */
327
+ /**
328
+ * Tests a function.
329
+ *
330
+ * Tests a function, by wrapping the function and checking its parameters and
331
+ * return value through {@link is} function. If some parameter or return value
332
+ * does not match the expected type, it returns `null`. Otherwise there's no
333
+ * type error, it returns the result of the function.
334
+ *
335
+ * By the way, if you want is not just testing type checking, but also finding
336
+ * detailed type error reason(s), then use {@link assertFunction} or
337
+ * {@link validateFunction} instead.
338
+ *
339
+ * On the other hand, if you don't want to allow any superfluous properties,
340
+ * utilize {@link equalsFunction}, {@link assertEqualsFunction} or
341
+ * {@link validateEqualsFunction} instead.
342
+ *
343
+ * @template T Target function type
344
+ * @param func Target function to test
345
+ * @returns The wrapper function with type tests
346
+ *
347
+ * @author Jeongho Nam - https://github.com/samchon
348
+ */
349
+ function isFunction<T extends (...args: any[]) => any>(
350
+ func: T,
351
+ ): T extends (...args: infer Arguments) => infer Output
352
+ ? Output extends Promise<infer R>
353
+ ? (...args: Arguments) => Promise<R | null>
354
+ : (...args: Arguments) => Output | null
355
+ : never;
356
+
357
+ /**
358
+ * @internal
359
+ */
360
+ function isFunction(): never {
361
+ halt("isFunction");
362
+ }
363
+ const isFunctionPure = /** @__PURE__ */ Object.assign<typeof isFunction, {}>(
364
+ isFunction,
365
+ /** @__PURE__ */ Namespace.is(),
366
+ );
367
+ export { isFunctionPure as isFunction };
368
+
369
+ /**
370
+ * Tests parameters.
371
+ *
372
+ * Tests a function, by wrapping the function and checking its parameters through
373
+ * {@link is} function. If some parameter does not match the expected type, it
374
+ * returns `null`. Otherwise there's no type error, it returns the result of the
375
+ * function.
376
+ *
377
+ * By the way, if you want is not just testing type checking, but also finding
378
+ * detailed type error reason(s), then use {@link assertParameters} or
379
+ * {@link validateParameters} instead.
380
+ *
381
+ * On the other hand, if you don't want to allow any superfluous properties,
382
+ * utilize {@link equalsParameters}, {@link assertEqualsParameters} or
383
+ * {@link validateEqualsParameters} instead.
384
+ *
385
+ * @template T Target function type
386
+ * @param func Target function to test
387
+ * @returns The wrapper function with type tests
388
+ *
389
+ * @author Jeongho Nam - https://github.com/samchon
390
+ */
391
+ function isParameters<T extends (...args: any[]) => any>(
392
+ func: T,
393
+ ): T extends (...args: infer Arguments) => infer Output
394
+ ? Output extends Promise<infer R>
395
+ ? (...args: Arguments) => Promise<R | null>
396
+ : (...args: Arguments) => Output | null
397
+ : never;
398
+
399
+ /**
400
+ * @internal
401
+ */
402
+ function isParameters(): never {
403
+ halt("isParameters");
404
+ }
405
+ const isParametersPure = /** @__PURE__ */ Object.assign<
406
+ typeof isParameters,
407
+ {}
408
+ >(isParameters, /** @__PURE__ */ Namespace.is());
409
+ export { isParametersPure as isParameters };
410
+
411
+ /**
412
+ * Tests return value.
413
+ *
414
+ * Tests a function, by wrapping the function and checking its return value through
415
+ * {@link is} function. If the return value does not match the expected type, it
416
+ * returns `null`. Otherwise there's no type error, it returns the result of the
417
+ * function.
418
+ *
419
+ * By the way, if you want is not just testing type checking, but also finding
420
+ * detailed type error reason(s), then use {@link assertReturn} or
421
+ * {@link validateReturn} instead.
422
+ *
423
+ * On the other hand, if you don't want to allow any superfluous properties,
424
+ * utilize {@link equalsReturn}, {@link assertEqualsReturn} or
425
+ * {@link validateEqualsReturn} instead.
426
+ *
427
+ * @template T Target function type
428
+ * @param func Target function to test
429
+ * @returns The wrapper function with type tests
430
+ *
431
+ * @author Jeongho Nam - https://github.com/samchon
432
+ */
433
+ function isReturn<T extends (...args: any[]) => any>(
434
+ func: T,
435
+ ): T extends (...args: infer Arguments) => infer Output
436
+ ? Output extends Promise<infer R>
437
+ ? (...args: Arguments) => Promise<R | null>
438
+ : (...args: Arguments) => Output | null
439
+ : never;
440
+
441
+ /**
442
+ * @internal
443
+ */
444
+ function isReturn(): never {
445
+ halt("isReturn");
446
+ }
447
+ const isReturnPure = /** @__PURE__ */ Object.assign<typeof isReturn, {}>(
448
+ isReturn,
449
+ /** @__PURE__ */ Namespace.is(),
450
+ );
451
+ export { isReturnPure as isReturn };
452
+
453
+ /**
454
+ * Tests a function with strict equality.
455
+ *
456
+ * Tests a function with strict equality, by wrapping the function and checking its
457
+ * parameters and return value through {@link isEquals} function. If some parameter
458
+ * or return value does not match the expected type, it returns `null`. Otherwise
459
+ * there's no type error, it returns the result of the function.
460
+ *
461
+ * By the way, if you want is not just testing type checking, but also finding
462
+ * detailed type error reason(s), then use {@link assertEqualsFunction} or
463
+ * {@link validateEqualsFunction} instead.
464
+ *
465
+ * On the other hand, if you want to allow any superfluous properties, utilize
466
+ * {@link isFunction}, {@link assertFunction} or {@link validateFunction} instead.
467
+ *
468
+ * @template T Target function type
469
+ * @param func Target function to test
470
+ * @returns The wrapper function with type tests
471
+ *
472
+ * @author Jeongho Nam - https://github.com/samchon
473
+ */
474
+ function equalsFunction<T extends (...args: any[]) => any>(
475
+ func: T,
476
+ ): T extends (...args: infer Arguments) => infer Output
477
+ ? Output extends Promise<infer R>
478
+ ? (...args: Arguments) => Promise<R | null>
479
+ : (...args: Arguments) => Output | null
480
+ : never;
481
+
482
+ /**
483
+ * @internal
484
+ */
485
+ function equalsFunction(): never {
486
+ halt("equalsFunction");
487
+ }
488
+ const equalsFunctionPure = /** @__PURE__ */ Object.assign<
489
+ typeof equalsFunction,
490
+ {}
491
+ >(equalsFunction, /** @__PURE__ */ Namespace.is());
492
+ export { equalsFunctionPure as equalsFunction };
493
+
494
+ /**
495
+ * Tests parameters with strict equality.
496
+ *
497
+ * Tests a function, by wrapping the function and checking its parameters through
498
+ * {@link isEquals} function. If some parameter does not match the expected type,
499
+ * it returns `null`. Otherwise there's no type error, it returns the result of the
500
+ * function.
501
+ *
502
+ * By the way, if you want is not just testing type checking, but also finding
503
+ * detailed type error reason(s), then use {@link assertEqualsParameters} or
504
+ * {@link validateEqualsParameters} instead.
505
+ *
506
+ * @template T Target function type
507
+ * @param func Target function to test
508
+ * @returns The wrapper function with type tests
509
+ *
510
+ * @author Jeongho Nam - https://github.com/samchon
511
+ */
512
+ function equalsParameters<T extends (...args: any[]) => any>(
513
+ func: T,
514
+ ): T extends (...args: infer Arguments) => infer Output
515
+ ? Output extends Promise<infer R>
516
+ ? (...args: Arguments) => Promise<R | null>
517
+ : (...args: Arguments) => Output | null
518
+ : never;
519
+
520
+ /**
521
+ * @internal
522
+ */
523
+ function equalsParameters(): never {
524
+ halt("equalsParameters");
525
+ }
526
+ const equalsParametersPure = /** @__PURE__ */ Object.assign<
527
+ typeof equalsParameters,
528
+ {}
529
+ >(equalsParameters, /** @__PURE__ */ Namespace.is());
530
+ export { equalsParametersPure as equalsParameters };
531
+
532
+ /**
533
+ * Tests return value with strict equality.
534
+ *
535
+ * Tests a function, by wrapping the function and checking its return value through
536
+ * {@link isEquals} function. If the return value does not match the expected type,
537
+ * it returns `null`. Otherwise there's no type error, it returns the result of the
538
+ * function.
539
+ *
540
+ * By the way, if you want is not just testing type checking, but also finding
541
+ * detailed type error reason(s), then use {@link assertEqualsReturn} or
542
+ * {@link validateEqualsReturn} instead.
543
+ *
544
+ * On the other hand, if you want to allow any superfluous properties, utilize
545
+ * {@link isReturn}, {@link assertReturn} or {@link validateReturn} instead.
546
+ *
547
+ * @template T Target function type
548
+ * @param func Target function to test
549
+ * @returns The wrapper function with type tests
550
+ *
551
+ * @author Jeongho Nam - https://github.com/samchon
552
+ */
553
+ function equalsReturn<T extends (...args: any[]) => any>(
554
+ func: T,
555
+ ): T extends (...args: infer Arguments) => infer Output
556
+ ? Output extends Promise<infer R>
557
+ ? (...args: Arguments) => Promise<R | null>
558
+ : (...args: Arguments) => Output | null
559
+ : never;
560
+
561
+ /**
562
+ * @internal
563
+ */
564
+ function equalsReturn(): never {
565
+ halt("equalsReturn");
566
+ }
567
+ const equalsReturnPure = /** @__PURE__ */ Object.assign<
568
+ typeof equalsReturn,
569
+ {}
570
+ >(equalsReturn, /** @__PURE__ */ Namespace.is());
571
+ export { equalsReturnPure as equalsReturn };
572
+
573
+ /* -----------------------------------------------------------
574
+ VALIDATE
575
+ ----------------------------------------------------------- */
576
+ /**
577
+ * Validates a function.
578
+ *
579
+ * Validates a function, by wrapping the function and checking its parameters and
580
+ * return value through {@link validate} function. If some parameter or return value
581
+ * does not match the expected type, it returns {@link IValidation.IError} typed
582
+ * object. Otherwise there's no type error, it returns {@link IValidation.ISuccess}
583
+ * typed object instead.
584
+ *
585
+ * For reference, {@link IValidation.IError.path} would be a little bit different with
586
+ * individual {@link validate} function. If the {@link IValidation.IError} occurs from
587
+ * some parameter, the path would start from `$input.parameters[number]`. Otherwise
588
+ * the path would start from `$input.return`.
589
+ *
590
+ * - `$input.parameters[0].~`
591
+ * - `$input.return.~`
592
+ *
593
+ * By the way, if what you want is not finding every type errors, but just finding
594
+ * the 1st type error, then use {@link assertFunction} instead. Otherwise, what you
595
+ * want is just validating parameters or return value only, you can use
596
+ * {@link validateParameters} or {@link validateReturn} instead.
597
+ *
598
+ * On the other hand, if you don't want to allow any superfluous properties, utilize
599
+ * {@link validateEqualsFunction} or {@link assertEqualsFunction} instead.
600
+ *
601
+ * @template T Target function type
602
+ * @param func Target function to validate
603
+ * @returns The wrapper function with type validations
604
+ *
605
+ * @author Jeongho Nam - https://github.com/samchon
606
+ */
607
+ function validateFunction<T extends (...args: any[]) => any>(
608
+ func: T,
609
+ ): T extends (...args: infer Arguments) => infer Output
610
+ ? Output extends Promise<infer R>
611
+ ? (...args: Arguments) => Promise<IValidation<R>>
612
+ : (...args: Arguments) => IValidation<Output>
613
+ : never;
614
+
615
+ /**
616
+ * @internal
617
+ */
618
+ function validateFunction(): never {
619
+ halt("validateFunction");
620
+ }
621
+ const validateFunctionPure = /** @__PURE__ */ Object.assign<
622
+ typeof validateFunction,
623
+ {}
624
+ >(validateFunction, /** @__PURE__ */ Namespace.validate());
625
+ export { validateFunctionPure as validateFunction };
626
+
627
+ /**
628
+ * Validates parameters.
629
+ *
630
+ * Validates a function, by wrapping the function and checking its parameters through
631
+ * {@link validate} function. If some parameter does not match the expected type, it
632
+ * returns {@link IValidation.IError} typed object. Otherwise there's no type error,
633
+ * it returns {@link IValidation.ISuccess} typed object instead.
634
+ *
635
+ * For reference, {@link IValidation.IError.path} would be a little bit different with
636
+ * individual {@link validate} function. If the {@link IValidation.IError} occurs from
637
+ * some parameter, the path would start from `$input.parameters[number]`.
638
+ *
639
+ * By the way, if what you want is not finding every type errors, but just finding
640
+ * the 1st type error, then use {@link assertParameters} instead. Otherwise, what you
641
+ * want is not only validating parameters, but also validating return value, you can
642
+ * use {@link validateFunction} instead.
643
+ *
644
+ * On the other hand, if you don't want to allow any superfluous properties, utilize
645
+ * {@link validateEqualsParameters} or {@link assertEqualsParameters} instead.
646
+ *
647
+ * @template T Target function type
648
+ * @param func Target function to validate
649
+ * @returns The wrapper function with type validations
650
+ *
651
+ * @author Jeongho Nam - https://github.com/samchon
652
+ */
653
+ function validateParameters<T extends (...args: any[]) => any>(
654
+ func: T,
655
+ ): T extends (...args: infer Arguments) => infer Output
656
+ ? Output extends Promise<infer R>
657
+ ? (...args: Arguments) => Promise<IValidation<R>>
658
+ : (...args: Arguments) => IValidation<Output>
659
+ : never;
660
+
661
+ /**
662
+ * @internal
663
+ */
664
+ function validateParameters(): never {
665
+ halt("validateReturn");
666
+ }
667
+ const validateParametersPure = /** @__PURE__ */ Object.assign<
668
+ typeof validateParameters,
669
+ {}
670
+ >(validateParameters, /** @__PURE__ */ Namespace.validate());
671
+ export { validateParametersPure as validateParameters };
672
+
673
+ /**
674
+ * Validates return value.
675
+ *
676
+ * Validates a function, by wrapping the function and checking its return value through
677
+ * {@link validate} function. If the return value does not match the expected type, it
678
+ * returns {@link IValidation.IError} typed object. Otherwise there's no type error,
679
+ * it returns {@link IValidation.ISuccess} typed object instead.
680
+ *
681
+ * For reference, {@link IValidation.IError.path} would be a little bit different with
682
+ * individual {@link validate} function. If the {@link IValidation.IError} occurs from
683
+ * the return value, the path would start from `$input.return`.
684
+ *
685
+ * By the way, if what you want is not finding every type errors, but just finding
686
+ * the 1st type error, then use {@link assertReturn} instead. Otherwise, what you want
687
+ * is not only validating return value, but also validating parameters, you can use
688
+ * {@link validateFunction} instead.
689
+ *
690
+ * On the other hand, if you don't want to allow any superfluous properties, utilize
691
+ * {@link validateEqualsReturn} or {@link assertEqualsReturn} instead.
692
+ *
693
+ * @template T Target function type
694
+ * @param func Target function to validate
695
+ * @returns The wrapper function with type validations
696
+ *
697
+ * @author Jeongho Nam - https://github.com/samchon
698
+ */
699
+ function validateReturn<T extends (...args: any[]) => any>(
700
+ func: T,
701
+ ): T extends (...args: infer Arguments) => infer Output
702
+ ? Output extends Promise<infer R>
703
+ ? (...args: Arguments) => Promise<IValidation<R>>
704
+ : (...args: Arguments) => IValidation<Output>
705
+ : never;
706
+
707
+ /**
708
+ * @internal
709
+ */
710
+ function validateReturn(): never {
711
+ halt("validateReturn");
712
+ }
713
+ const validateReturnPure = /** @__PURE__ */ Object.assign<
714
+ typeof validateReturn,
715
+ {}
716
+ >(validateReturn, /** @__PURE__ */ Namespace.validate());
717
+ export { validateReturnPure as validateReturn };
718
+
719
+ /**
720
+ * Validates a function with strict equality.
721
+ *
722
+ * Validates a function with strict equality, by wrapping the function and checking
723
+ * its parameters and return value through {@link validateEquals} function. If some
724
+ * parameter or return value does not match the expected type, it returns
725
+ * {@link IValidation.IError} typed object. Otherwise there's no type error, it
726
+ * returns {@link IValidation.ISuccess} typed object instead.
727
+ *
728
+ * For reference, {@link IValidation.IError.path} would be a little bit different with
729
+ * individual {@link validateEquals} function. If the {@link IValidation.IError} occurs
730
+ * from some parameter, the path would start from `$input.parameters[number]`. Otherwise
731
+ * the path would start from `$input.return`.
732
+ *
733
+ * - `$input.parameters[0].~`
734
+ * - `$input.return.~`
735
+ *
736
+ * By the way, if what you want is not finding every type errors, but just finding
737
+ * the 1st type error, then use {@link assertEqualsFunction} instead. Otherwise, what
738
+ * you want is just validating parameters or return value only, you can use
739
+ * {@link validateEqualsParameters} or {@link validateEqualsReturn} instead.
740
+ *
741
+ * On the other hand, if you want to allow any superfluous properties, utilize
742
+ * {@link validateFunction} or {@link assertFunction} instead.
743
+ *
744
+ * @template T Target function type
745
+ * @param func Target function to validate
746
+ * @returns The wrapper function with type validations
747
+ *
748
+ * @author Jeongho Nam - https://github.com/samchon
749
+ */
750
+ function validateEqualsFunction<T extends (...args: any[]) => any>(
751
+ func: T,
752
+ ): T extends (...args: infer Arguments) => infer Output
753
+ ? Output extends Promise<infer R>
754
+ ? (...args: Arguments) => Promise<IValidation<R>>
755
+ : (...args: Arguments) => IValidation<Output>
756
+ : never;
757
+
758
+ /**
759
+ * @internal
760
+ */
761
+ function validateEqualsFunction(): never {
762
+ halt("validateEqualsFunction");
763
+ }
764
+ const validateEqualsFunctionPure = /** @__PURE__ */ Object.assign<
765
+ typeof validateEqualsFunction,
766
+ {}
767
+ >(validateEqualsFunction, /** @__PURE__ */ Namespace.validate());
768
+ export { validateEqualsFunctionPure as validateEqualsFunction };
769
+
770
+ /**
771
+ * Validates parameters with strict equality.
772
+ *
773
+ * Validates a function, by wrapping the function and checking its parameters through
774
+ * {@link validateEquals} function. If some parameter does not match the expected type,
775
+ * it returns {@link IValidation.IError} typed object. Otherwise there's no type error,
776
+ * it returns {@link IValidation.ISuccess} typed object instead.
777
+ *
778
+ * For reference, {@link IValidation.IError.path} would be a little bit different with
779
+ * individual {@link validateEquals} function. If the {@link IValidation.IError} occurs
780
+ * from some parameter, the path would start from `$input.parameters[number]`.
781
+ *
782
+ * By the way, if what you want is not finding every type errors, but just finding
783
+ * the 1st type error, then use {@link assertEqualsParameters} instead. Otherwise,
784
+ * what you want is not only validating parameters, but also validating return value,
785
+ * you can use {@link validateEqualsFunction} instead.
786
+ *
787
+ * On the other hand, if you want to allow any superfluous properties, utilize
788
+ * {@link validateParameters} or {@link assertParameters} instead.
789
+ *
790
+ * @template T Target function type
791
+ * @param func Target function to validate
792
+ * @returns The wrapper function with type validations
793
+ *
794
+ * @author Jeongho Nam - https://github.com/samchon
795
+ */
796
+ function validateEqualsParameters<T extends (...args: any[]) => any>(
797
+ func: T,
798
+ ): T extends (...args: infer Arguments) => infer Output
799
+ ? Output extends Promise<infer R>
800
+ ? (...args: Arguments) => Promise<IValidation<R>>
801
+ : (...args: Arguments) => IValidation<Output>
802
+ : never;
803
+
804
+ /**
805
+ * @internal
806
+ */
807
+ function validateEqualsParameters(): never {
808
+ halt("validateEqualsParameters");
809
+ }
810
+ const validateEqualsParametersPure = /** @__PURE__ */ Object.assign<
811
+ typeof validateEqualsParameters,
812
+ {}
813
+ >(validateEqualsParameters, /** @__PURE__ */ Namespace.validate());
814
+ export { validateEqualsParametersPure as validateEqualsParameters };
815
+
816
+ /**
817
+ * Validates return value with strict equality.
818
+ *
819
+ * Validates a function, by wrapping the function and checking its return value through
820
+ * {@link validateEquals} function. If the return value does not match the expected type,
821
+ * it returns {@link IValidation.IError} typed object. Otherwise there's no type error,
822
+ * it returns {@link IValidation.ISuccess} typed object instead.
823
+ *
824
+ * For reference, {@link IValidation.IError.path} would be a little bit different with
825
+ * individual {@link validateEquals} function. If the {@link IValidation.IError} occurs
826
+ * from the return value, the path would start from `$input.return`.
827
+ *
828
+ * By the way, if what you want is not finding every type errors, but just finding
829
+ * the 1st type error, then use {@link assertEqualsReturn} instead. Otherwise, what you
830
+ * want is not only validating return value, but also validating parameters, you can use
831
+ * {@link validateEqualsFunction} instead.
832
+ *
833
+ * On the other hand, if you want to allow any superfluous properties, utilize
834
+ * {@link validateReturn} or {@link assertReturn} instead.
835
+ *
836
+ * @template T Target function type
837
+ * @param func Target function to validate
838
+ * @returns The wrapper function with type validations
839
+ *
840
+ * @author Jeongho Nam - https://github.com/samchon
841
+ */
842
+ function validateEqualsReturn<T extends (...args: any[]) => any>(
843
+ func: T,
844
+ ): T extends (...args: infer Arguments) => infer Output
845
+ ? Output extends Promise<infer R>
846
+ ? (...args: Arguments) => Promise<IValidation<R>>
847
+ : (...args: Arguments) => IValidation<Output>
848
+ : never;
849
+
850
+ /**
851
+ * @internal
852
+ */
853
+ function validateEqualsReturn(): never {
854
+ halt("validateEqualsReturn");
855
+ }
856
+ const validateEqualsReturnPure = /** @__PURE__ */ Object.assign<
857
+ typeof validateEqualsReturn,
858
+ {}
859
+ >(validateEqualsReturn, /** @__PURE__ */ Namespace.validate());
860
+ export { validateEqualsReturnPure as validateEqualsReturn };
861
+
862
+ /* -----------------------------------------------------------
863
+ HALTER
864
+ ----------------------------------------------------------- */
865
+ /**
866
+ * @internal
867
+ */
868
+ function halt(name: string): never {
869
+ throw new Error(
870
+ `Error on typia.functional.${name}(): no transform has been configured. Read and follow https://typia.io/docs/setup please.`,
871
+ );
872
+ }