typia 9.7.1 → 9.7.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/lib/AssertionGuard.d.mts +27 -25
- package/lib/AssertionGuard.d.ts +27 -25
- package/lib/CamelCase.d.mts +1 -1
- package/lib/CamelCase.d.ts +1 -1
- package/lib/IRandomGenerator.d.mts +44 -42
- package/lib/IRandomGenerator.d.ts +44 -42
- package/lib/IReadableURLSearchParams.d.mts +2 -2
- package/lib/IReadableURLSearchParams.d.ts +2 -2
- package/lib/PascalCase.d.mts +1 -1
- package/lib/PascalCase.d.ts +1 -1
- package/lib/Primitive.d.mts +20 -22
- package/lib/Primitive.d.ts +20 -22
- package/lib/Resolved.d.mts +16 -18
- package/lib/Resolved.d.ts +16 -18
- package/lib/SnakeCase.d.mts +3 -2
- package/lib/SnakeCase.d.ts +3 -2
- package/lib/TypeGuardError.d.mts +88 -61
- package/lib/TypeGuardError.d.ts +88 -61
- package/lib/TypeGuardError.js +40 -29
- package/lib/TypeGuardError.js.map +1 -1
- package/lib/TypeGuardError.mjs +70 -48
- package/lib/factories/MetadataCollection.js +4 -12
- package/lib/factories/MetadataCollection.js.map +1 -1
- package/lib/factories/MetadataCollection.mjs +4 -12
- package/lib/factories/MetadataCommentTagFactory.js +5 -15
- package/lib/factories/MetadataCommentTagFactory.js.map +1 -1
- package/lib/factories/MetadataCommentTagFactory.mjs +5 -15
- package/lib/factories/MetadataFactory.js +1 -3
- package/lib/factories/MetadataFactory.js.map +1 -1
- package/lib/factories/MetadataFactory.mjs +1 -3
- package/lib/factories/ProtobufFactory.js +1 -3
- package/lib/factories/ProtobufFactory.js.map +1 -1
- package/lib/factories/ProtobufFactory.mjs +1 -3
- package/lib/functional.d.mts +196 -195
- package/lib/functional.d.ts +196 -195
- package/lib/functional.js +18 -54
- package/lib/functional.js.map +1 -1
- package/lib/functional.mjs +18 -54
- package/lib/http.d.mts +303 -319
- package/lib/http.d.ts +303 -319
- package/lib/http.js +26 -78
- package/lib/http.js.map +1 -1
- package/lib/http.mjs +26 -78
- package/lib/internal/_ProtobufReader.d.mts +3 -9
- package/lib/internal/_ProtobufReader.d.ts +3 -9
- package/lib/internal/_ProtobufReader.js.map +1 -1
- package/lib/internal/_ProtobufReader.mjs +3 -9
- package/lib/internal/_ProtobufSizer.d.mts +4 -12
- package/lib/internal/_ProtobufSizer.d.ts +4 -12
- package/lib/internal/_ProtobufSizer.js.map +1 -1
- package/lib/internal/_ProtobufSizer.mjs +4 -12
- package/lib/internal/_ProtobufWriter.d.mts +5 -15
- package/lib/internal/_ProtobufWriter.d.ts +5 -15
- package/lib/internal/_ProtobufWriter.js.map +1 -1
- package/lib/internal/_ProtobufWriter.mjs +5 -15
- package/lib/internal/_jsonStringifyString.d.mts +4 -4
- package/lib/internal/_jsonStringifyString.d.ts +4 -4
- package/lib/internal/_jsonStringifyString.js +4 -4
- package/lib/internal/_jsonStringifyString.mjs +4 -4
- package/lib/json.d.mts +174 -195
- package/lib/json.d.ts +174 -195
- package/lib/json.js +16 -48
- package/lib/json.js.map +1 -1
- package/lib/json.mjs +16 -48
- package/lib/llm.d.mts +275 -192
- package/lib/llm.d.ts +275 -192
- package/lib/llm.js +4 -12
- package/lib/llm.js.map +1 -1
- package/lib/llm.mjs +4 -12
- package/lib/misc.d.mts +149 -172
- package/lib/misc.d.ts +149 -172
- package/lib/misc.js +17 -51
- package/lib/misc.js.map +1 -1
- package/lib/misc.mjs +17 -51
- package/lib/module.d.mts +263 -275
- package/lib/module.d.ts +263 -275
- package/lib/module.js +18 -54
- package/lib/module.js.map +1 -1
- package/lib/module.mjs +18 -54
- package/lib/notations.d.mts +153 -174
- package/lib/notations.d.ts +153 -174
- package/lib/notations.js +24 -72
- package/lib/notations.js.map +1 -1
- package/lib/notations.mjs +24 -72
- package/lib/programmers/FeatureProgrammer.d.mts +19 -41
- package/lib/programmers/FeatureProgrammer.d.ts +19 -41
- package/lib/programmers/FeatureProgrammer.js.map +1 -1
- package/lib/programmers/ImportProgrammer.js +3 -9
- package/lib/programmers/ImportProgrammer.js.map +1 -1
- package/lib/programmers/ImportProgrammer.mjs +3 -9
- package/lib/programmers/RandomProgrammer.js +6 -0
- package/lib/programmers/RandomProgrammer.js.map +1 -1
- package/lib/programmers/RandomProgrammer.mjs +6 -0
- package/lib/programmers/helpers/ProtobufWire.d.mts +13 -13
- package/lib/programmers/helpers/ProtobufWire.d.ts +13 -13
- package/lib/programmers/internal/check_array_length.js +2 -6
- package/lib/programmers/internal/check_array_length.js.map +1 -1
- package/lib/programmers/internal/check_array_length.mjs +2 -6
- package/lib/programmers/internal/check_bigint.js +2 -6
- package/lib/programmers/internal/check_bigint.js.map +1 -1
- package/lib/programmers/internal/check_bigint.mjs +2 -6
- package/lib/programmers/internal/check_dynamic_key.js +2 -6
- package/lib/programmers/internal/check_dynamic_key.js.map +1 -1
- package/lib/programmers/internal/check_dynamic_key.mjs +2 -6
- package/lib/programmers/internal/check_dynamic_properties.js +3 -9
- package/lib/programmers/internal/check_dynamic_properties.js.map +1 -1
- package/lib/programmers/internal/check_dynamic_properties.mjs +3 -9
- package/lib/programmers/internal/check_everything.js +1 -3
- package/lib/programmers/internal/check_everything.js.map +1 -1
- package/lib/programmers/internal/check_everything.mjs +1 -3
- package/lib/programmers/internal/check_native.js +2 -6
- package/lib/programmers/internal/check_native.js.map +1 -1
- package/lib/programmers/internal/check_native.mjs +2 -6
- package/lib/programmers/internal/check_number.js +2 -6
- package/lib/programmers/internal/check_number.js.map +1 -1
- package/lib/programmers/internal/check_number.mjs +2 -6
- package/lib/programmers/internal/check_object.js +2 -6
- package/lib/programmers/internal/check_object.js.map +1 -1
- package/lib/programmers/internal/check_object.mjs +2 -6
- package/lib/programmers/internal/check_string.js +2 -6
- package/lib/programmers/internal/check_string.js.map +1 -1
- package/lib/programmers/internal/check_string.mjs +2 -6
- package/lib/programmers/internal/check_template.js +1 -3
- package/lib/programmers/internal/check_template.js.map +1 -1
- package/lib/programmers/internal/check_template.mjs +1 -3
- package/lib/programmers/internal/check_union_array_like.js +1 -3
- package/lib/programmers/internal/check_union_array_like.js.map +1 -1
- package/lib/programmers/internal/check_union_array_like.mjs +1 -3
- package/lib/programmers/internal/decode_union_object.js +2 -6
- package/lib/programmers/internal/decode_union_object.js.map +1 -1
- package/lib/programmers/internal/decode_union_object.mjs +2 -6
- package/lib/programmers/internal/feature_object_entries.js +1 -3
- package/lib/programmers/internal/feature_object_entries.js.map +1 -1
- package/lib/programmers/internal/feature_object_entries.mjs +1 -3
- package/lib/programmers/internal/json_schema_escaped.js +2 -6
- package/lib/programmers/internal/json_schema_escaped.js.map +1 -1
- package/lib/programmers/internal/json_schema_escaped.mjs +2 -6
- package/lib/programmers/internal/json_schema_object.js +3 -9
- package/lib/programmers/internal/json_schema_object.js.map +1 -1
- package/lib/programmers/internal/json_schema_object.mjs +3 -9
- package/lib/programmers/internal/metadata_to_pattern.js +1 -3
- package/lib/programmers/internal/metadata_to_pattern.js.map +1 -1
- package/lib/programmers/internal/metadata_to_pattern.mjs +1 -3
- package/lib/programmers/internal/postfix_of_tuple.js +1 -3
- package/lib/programmers/internal/postfix_of_tuple.js.map +1 -1
- package/lib/programmers/internal/postfix_of_tuple.mjs +1 -3
- package/lib/programmers/internal/prune_object_properties.js +1 -3
- package/lib/programmers/internal/prune_object_properties.js.map +1 -1
- package/lib/programmers/internal/prune_object_properties.mjs +1 -3
- package/lib/programmers/internal/stringify_dynamic_properties.js +2 -6
- package/lib/programmers/internal/stringify_dynamic_properties.js.map +1 -1
- package/lib/programmers/internal/stringify_dynamic_properties.mjs +2 -6
- package/lib/programmers/internal/stringify_native.js +1 -3
- package/lib/programmers/internal/stringify_native.js.map +1 -1
- package/lib/programmers/internal/stringify_native.mjs +1 -3
- package/lib/programmers/internal/stringify_regular_properties.js +2 -6
- package/lib/programmers/internal/stringify_regular_properties.js.map +1 -1
- package/lib/programmers/internal/stringify_regular_properties.mjs +2 -6
- package/lib/programmers/internal/template_to_pattern.js +1 -3
- package/lib/programmers/internal/template_to_pattern.js.map +1 -1
- package/lib/programmers/internal/template_to_pattern.mjs +1 -3
- package/lib/programmers/internal/wrap_metadata_rest_tuple.js +1 -3
- package/lib/programmers/internal/wrap_metadata_rest_tuple.js.map +1 -1
- package/lib/programmers/internal/wrap_metadata_rest_tuple.mjs +1 -3
- package/lib/programmers/json/JsonStringifyProgrammer.js +2 -2
- package/lib/programmers/json/JsonStringifyProgrammer.js.map +1 -1
- package/lib/programmers/json/JsonStringifyProgrammer.mjs +2 -2
- package/lib/protobuf.d.mts +290 -297
- package/lib/protobuf.d.ts +290 -297
- package/lib/protobuf.js +17 -51
- package/lib/protobuf.js.map +1 -1
- package/lib/protobuf.mjs +17 -51
- package/lib/reflect.d.mts +2 -4
- package/lib/reflect.d.ts +2 -4
- package/lib/reflect.js +1 -3
- package/lib/reflect.js.map +1 -1
- package/lib/reflect.mjs +1 -3
- package/lib/schemas/json/IJsonApplication.d.mts +4 -4
- package/lib/schemas/json/IJsonApplication.d.ts +4 -4
- package/lib/schemas/json/IJsonSchemaCollection.d.mts +73 -56
- package/lib/schemas/json/IJsonSchemaCollection.d.ts +73 -56
- package/lib/schemas/json/IJsonSchemaUnit.d.mts +83 -70
- package/lib/schemas/json/IJsonSchemaUnit.d.ts +83 -70
- package/lib/schemas/metadata/Metadata.d.mts +1 -3
- package/lib/schemas/metadata/Metadata.d.ts +1 -3
- package/lib/schemas/metadata/Metadata.js +9 -27
- package/lib/schemas/metadata/Metadata.js.map +1 -1
- package/lib/schemas/metadata/Metadata.mjs +9 -27
- package/lib/schemas/metadata/MetadataAliasType.d.mts +1 -3
- package/lib/schemas/metadata/MetadataAliasType.d.ts +1 -3
- package/lib/schemas/metadata/MetadataAliasType.js +3 -9
- package/lib/schemas/metadata/MetadataAliasType.js.map +1 -1
- package/lib/schemas/metadata/MetadataAliasType.mjs +3 -9
- package/lib/schemas/metadata/MetadataApplication.d.mts +1 -3
- package/lib/schemas/metadata/MetadataApplication.d.ts +1 -3
- package/lib/schemas/metadata/MetadataApplication.js +2 -6
- package/lib/schemas/metadata/MetadataApplication.js.map +1 -1
- package/lib/schemas/metadata/MetadataApplication.mjs +2 -6
- package/lib/schemas/metadata/MetadataArray.d.mts +1 -3
- package/lib/schemas/metadata/MetadataArray.d.ts +1 -3
- package/lib/schemas/metadata/MetadataArray.js +1 -3
- package/lib/schemas/metadata/MetadataArray.js.map +1 -1
- package/lib/schemas/metadata/MetadataArray.mjs +1 -3
- package/lib/schemas/metadata/MetadataArrayType.d.mts +1 -3
- package/lib/schemas/metadata/MetadataArrayType.d.ts +1 -3
- package/lib/schemas/metadata/MetadataArrayType.js +3 -9
- package/lib/schemas/metadata/MetadataArrayType.js.map +1 -1
- package/lib/schemas/metadata/MetadataArrayType.mjs +3 -9
- package/lib/schemas/metadata/MetadataAtomic.js +1 -3
- package/lib/schemas/metadata/MetadataAtomic.js.map +1 -1
- package/lib/schemas/metadata/MetadataAtomic.mjs +1 -3
- package/lib/schemas/metadata/MetadataEscaped.d.mts +1 -3
- package/lib/schemas/metadata/MetadataEscaped.d.ts +1 -3
- package/lib/schemas/metadata/MetadataEscaped.js +3 -9
- package/lib/schemas/metadata/MetadataEscaped.js.map +1 -1
- package/lib/schemas/metadata/MetadataEscaped.mjs +3 -9
- package/lib/schemas/metadata/MetadataFunction.d.mts +1 -3
- package/lib/schemas/metadata/MetadataFunction.d.ts +1 -3
- package/lib/schemas/metadata/MetadataFunction.js +2 -6
- package/lib/schemas/metadata/MetadataFunction.js.map +1 -1
- package/lib/schemas/metadata/MetadataFunction.mjs +2 -6
- package/lib/schemas/metadata/MetadataObject.d.mts +1 -3
- package/lib/schemas/metadata/MetadataObject.d.ts +1 -3
- package/lib/schemas/metadata/MetadataObject.js +1 -3
- package/lib/schemas/metadata/MetadataObject.js.map +1 -1
- package/lib/schemas/metadata/MetadataObject.mjs +1 -3
- package/lib/schemas/metadata/MetadataObjectType.d.mts +1 -3
- package/lib/schemas/metadata/MetadataObjectType.d.ts +1 -3
- package/lib/schemas/metadata/MetadataObjectType.js +5 -15
- package/lib/schemas/metadata/MetadataObjectType.js.map +1 -1
- package/lib/schemas/metadata/MetadataObjectType.mjs +6 -18
- package/lib/schemas/metadata/MetadataParameter.js +1 -3
- package/lib/schemas/metadata/MetadataParameter.js.map +1 -1
- package/lib/schemas/metadata/MetadataParameter.mjs +1 -3
- package/lib/schemas/metadata/MetadataProperty.d.mts +1 -3
- package/lib/schemas/metadata/MetadataProperty.d.ts +1 -3
- package/lib/schemas/metadata/MetadataProperty.js +3 -9
- package/lib/schemas/metadata/MetadataProperty.js.map +1 -1
- package/lib/schemas/metadata/MetadataProperty.mjs +3 -9
- package/lib/schemas/metadata/MetadataTemplate.js +1 -3
- package/lib/schemas/metadata/MetadataTemplate.js.map +1 -1
- package/lib/schemas/metadata/MetadataTemplate.mjs +1 -3
- package/lib/schemas/metadata/MetadataTuple.d.mts +1 -3
- package/lib/schemas/metadata/MetadataTuple.d.ts +1 -3
- package/lib/schemas/metadata/MetadataTuple.js +2 -6
- package/lib/schemas/metadata/MetadataTuple.js.map +1 -1
- package/lib/schemas/metadata/MetadataTuple.mjs +2 -6
- package/lib/schemas/metadata/MetadataTupleType.js +2 -6
- package/lib/schemas/metadata/MetadataTupleType.js.map +1 -1
- package/lib/schemas/metadata/MetadataTupleType.mjs +3 -9
- package/lib/tags/Constant.d.mts +16 -16
- package/lib/tags/Constant.d.ts +16 -16
- package/lib/tags/ContentMediaType.d.mts +7 -7
- package/lib/tags/ContentMediaType.d.ts +7 -7
- package/lib/tags/Default.d.mts +19 -19
- package/lib/tags/Default.d.ts +19 -19
- package/lib/tags/Example.d.mts +18 -18
- package/lib/tags/Example.d.ts +18 -18
- package/lib/tags/Examples.d.mts +23 -23
- package/lib/tags/Examples.d.ts +23 -23
- package/lib/tags/ExclusiveMaximum.d.mts +8 -5
- package/lib/tags/ExclusiveMaximum.d.ts +8 -5
- package/lib/tags/ExclusiveMinimum.d.mts +8 -5
- package/lib/tags/ExclusiveMinimum.d.ts +8 -5
- package/lib/tags/Format.d.mts +12 -8
- package/lib/tags/Format.d.ts +12 -8
- package/lib/tags/JsonSchemaPlugin.d.mts +20 -18
- package/lib/tags/JsonSchemaPlugin.d.ts +20 -18
- package/lib/tags/MaxItems.d.mts +9 -9
- package/lib/tags/MaxItems.d.ts +9 -9
- package/lib/tags/MaxLength.d.mts +6 -5
- package/lib/tags/MaxLength.d.ts +6 -5
- package/lib/tags/Maximum.d.mts +9 -7
- package/lib/tags/Maximum.d.ts +9 -7
- package/lib/tags/MinItems.d.mts +9 -9
- package/lib/tags/MinItems.d.ts +9 -9
- package/lib/tags/MinLength.d.mts +6 -5
- package/lib/tags/MinLength.d.ts +6 -5
- package/lib/tags/Minimum.d.mts +9 -7
- package/lib/tags/Minimum.d.ts +9 -7
- package/lib/tags/MultipleOf.d.mts +10 -7
- package/lib/tags/MultipleOf.d.ts +10 -7
- package/lib/tags/Pattern.d.mts +7 -4
- package/lib/tags/Pattern.d.ts +7 -4
- package/lib/tags/Sequence.d.mts +19 -17
- package/lib/tags/Sequence.d.ts +19 -17
- package/lib/tags/TagBase.d.mts +21 -28
- package/lib/tags/TagBase.d.ts +21 -28
- package/lib/tags/Type.d.mts +12 -11
- package/lib/tags/Type.d.ts +12 -11
- package/lib/tags/UniqueItems.d.mts +10 -9
- package/lib/tags/UniqueItems.d.ts +10 -9
- package/lib/tags/internal/FormatCheatSheet.d.mts +1 -3
- package/lib/tags/internal/FormatCheatSheet.d.ts +1 -3
- package/lib/tags/internal/FormatCheatSheet.js +1 -3
- package/lib/tags/internal/FormatCheatSheet.js.map +1 -1
- package/lib/tags/internal/FormatCheatSheet.mjs +1 -3
- package/lib/transformers/ITransformOptions.d.mts +27 -19
- package/lib/transformers/ITransformOptions.d.ts +27 -19
- package/lib/transformers/ImportTransformer.js +5 -10
- package/lib/transformers/ImportTransformer.js.map +1 -1
- package/lib/transformers/ImportTransformer.mjs +5 -10
- package/lib/transformers/NoTransformConfigurationError.js +1 -3
- package/lib/transformers/NoTransformConfigurationError.js.map +1 -1
- package/lib/transformers/NoTransformConfigurationError.mjs +1 -3
- package/lib/transformers/features/llm/LlmApplicationTransformer.js +1 -3
- package/lib/transformers/features/llm/LlmApplicationTransformer.js.map +1 -1
- package/lib/transformers/features/llm/LlmApplicationTransformer.mjs +1 -3
- package/lib/typings/Equal.d.mts +6 -6
- package/lib/typings/Equal.d.ts +6 -6
- package/package.json +2 -1
- package/src/AssertionGuard.ts +27 -25
- package/src/CamelCase.ts +1 -1
- package/src/IRandomGenerator.ts +44 -42
- package/src/IReadableURLSearchParams.ts +2 -2
- package/src/PascalCase.ts +1 -1
- package/src/Primitive.ts +20 -22
- package/src/Resolved.ts +16 -18
- package/src/SnakeCase.ts +3 -2
- package/src/TypeGuardError.ts +101 -64
- package/src/factories/MetadataCollection.ts +4 -12
- package/src/factories/MetadataCommentTagFactory.ts +8 -24
- package/src/factories/MetadataFactory.ts +1 -3
- package/src/factories/ProtobufFactory.ts +1 -3
- package/src/functional.ts +214 -249
- package/src/http.ts +329 -397
- package/src/internal/_ProtobufReader.ts +3 -9
- package/src/internal/_ProtobufSizer.ts +4 -12
- package/src/internal/_ProtobufWriter.ts +5 -15
- package/src/internal/_jsonStringifyString.ts +4 -4
- package/src/json.ts +190 -243
- package/src/llm.ts +279 -204
- package/src/misc.ts +166 -223
- package/src/module.ts +281 -329
- package/src/notations.ts +177 -246
- package/src/programmers/FeatureProgrammer.ts +19 -41
- package/src/programmers/ImportProgrammer.ts +3 -9
- package/src/programmers/RandomProgrammer.ts +6 -1
- package/src/programmers/helpers/ProtobufWire.ts +13 -13
- package/src/programmers/internal/check_array_length.ts +2 -6
- package/src/programmers/internal/check_bigint.ts +2 -6
- package/src/programmers/internal/check_dynamic_key.ts +2 -6
- package/src/programmers/internal/check_dynamic_properties.ts +3 -9
- package/src/programmers/internal/check_everything.ts +1 -3
- package/src/programmers/internal/check_native.ts +2 -6
- package/src/programmers/internal/check_number.ts +2 -6
- package/src/programmers/internal/check_object.ts +3 -9
- package/src/programmers/internal/check_string.ts +2 -6
- package/src/programmers/internal/check_template.ts +1 -3
- package/src/programmers/internal/check_union_array_like.ts +2 -6
- package/src/programmers/internal/decode_union_object.ts +3 -9
- package/src/programmers/internal/feature_object_entries.ts +1 -3
- package/src/programmers/internal/json_schema_escaped.ts +2 -6
- package/src/programmers/internal/json_schema_object.ts +4 -12
- package/src/programmers/internal/metadata_to_pattern.ts +1 -3
- package/src/programmers/internal/postfix_of_tuple.ts +1 -3
- package/src/programmers/internal/prune_object_properties.ts +1 -3
- package/src/programmers/internal/stringify_dynamic_properties.ts +2 -6
- package/src/programmers/internal/stringify_native.ts +1 -3
- package/src/programmers/internal/stringify_regular_properties.ts +2 -6
- package/src/programmers/internal/template_to_pattern.ts +1 -3
- package/src/programmers/internal/wrap_metadata_rest_tuple.ts +1 -3
- package/src/programmers/json/JsonStringifyProgrammer.ts +2 -2
- package/src/protobuf.ts +307 -348
- package/src/reflect.ts +3 -7
- package/src/schemas/json/IJsonApplication.ts +4 -4
- package/src/schemas/json/IJsonSchemaCollection.ts +73 -56
- package/src/schemas/json/IJsonSchemaUnit.ts +83 -70
- package/src/schemas/metadata/IMetadataTypeTag.ts +1 -3
- package/src/schemas/metadata/Metadata.ts +9 -27
- package/src/schemas/metadata/MetadataAliasType.ts +3 -9
- package/src/schemas/metadata/MetadataApplication.ts +2 -6
- package/src/schemas/metadata/MetadataArray.ts +1 -3
- package/src/schemas/metadata/MetadataArrayType.ts +3 -9
- package/src/schemas/metadata/MetadataAtomic.ts +1 -3
- package/src/schemas/metadata/MetadataEscaped.ts +3 -9
- package/src/schemas/metadata/MetadataFunction.ts +2 -6
- package/src/schemas/metadata/MetadataObject.ts +1 -3
- package/src/schemas/metadata/MetadataObjectType.ts +6 -18
- package/src/schemas/metadata/MetadataParameter.ts +1 -3
- package/src/schemas/metadata/MetadataProperty.ts +3 -9
- package/src/schemas/metadata/MetadataTemplate.ts +1 -3
- package/src/schemas/metadata/MetadataTuple.ts +2 -6
- package/src/schemas/metadata/MetadataTupleType.ts +3 -9
- package/src/tags/Constant.ts +16 -16
- package/src/tags/ContentMediaType.ts +7 -7
- package/src/tags/Default.ts +19 -19
- package/src/tags/Example.ts +18 -18
- package/src/tags/Examples.ts +23 -23
- package/src/tags/ExclusiveMaximum.ts +8 -5
- package/src/tags/ExclusiveMinimum.ts +8 -5
- package/src/tags/Format.ts +12 -8
- package/src/tags/JsonSchemaPlugin.ts +20 -18
- package/src/tags/MaxItems.ts +9 -9
- package/src/tags/MaxLength.ts +6 -5
- package/src/tags/Maximum.ts +9 -7
- package/src/tags/MinItems.ts +9 -9
- package/src/tags/MinLength.ts +6 -5
- package/src/tags/Minimum.ts +9 -7
- package/src/tags/MultipleOf.ts +10 -7
- package/src/tags/Pattern.ts +7 -4
- package/src/tags/Sequence.ts +19 -17
- package/src/tags/TagBase.ts +21 -28
- package/src/tags/Type.ts +12 -11
- package/src/tags/UniqueItems.ts +10 -9
- package/src/tags/internal/FormatCheatSheet.ts +1 -3
- package/src/transformers/ITransformOptions.ts +27 -19
- package/src/transformers/ImportTransformer.ts +5 -10
- package/src/transformers/NoTransformConfigurationError.ts +1 -3
- package/src/transformers/features/llm/LlmApplicationTransformer.ts +1 -3
- package/src/typings/Equal.ts +6 -6
package/src/functional.ts
CHANGED
|
@@ -15,42 +15,40 @@ import { TypeGuardError } from "./TypeGuardError";
|
|
|
15
15
|
* Asserts a function.
|
|
16
16
|
*
|
|
17
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
|
|
19
|
-
* does not match the expected type, it throws an {@link TypeGuardError} or
|
|
20
|
-
* error generated by the
|
|
18
|
+
* return value through {@link assert} function. If some parameter or return
|
|
19
|
+
* value does not match the expected type, it throws an {@link TypeGuardError} or
|
|
20
|
+
* a custom error generated by the _errorFactory_ parameter.
|
|
21
21
|
*
|
|
22
|
-
* For reference, {@link TypeGuardError.path} would be a little bit different
|
|
23
|
-
* individual {@link assert} function. If the {@link TypeGuardError} occurs
|
|
24
|
-
* some parameter, the path would start from `$input.parameters[number]`.
|
|
25
|
-
* the path would start from `$input.return`.
|
|
22
|
+
* For reference, {@link TypeGuardError.path} would be a little bit different
|
|
23
|
+
* with individual {@link assert} function. If the {@link TypeGuardError} occurs
|
|
24
|
+
* from some parameter, the path would start from `$input.parameters[number]`.
|
|
25
|
+
* Otherwise the path would start from `$input.return`.
|
|
26
26
|
*
|
|
27
27
|
* - `$input.parameters[0].~`
|
|
28
28
|
* - `$input.return.~`
|
|
29
29
|
*
|
|
30
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
|
|
32
|
-
* instead. Otherwise, what you want is just asserting
|
|
33
|
-
* only, you can use {@link assertParameters} or
|
|
31
|
+
* assertion, but also finding every type errors, then use
|
|
32
|
+
* {@link validateFunction} instead. Otherwise, what you want is just asserting
|
|
33
|
+
* parameters or return value only, you can use {@link assertParameters} or
|
|
34
|
+
* {@link assertReturn} instead.
|
|
34
35
|
*
|
|
35
36
|
* On the other hand, if don't want to allow any superfluous properties, utilize
|
|
36
37
|
* {@link assertEqualsFunction} or {@link validateEqualsFunction} instead.
|
|
37
38
|
*
|
|
39
|
+
* @author Jeongho Nam - https://github.com/samchon
|
|
38
40
|
* @template T Target function type
|
|
39
41
|
* @param func Target function to assert
|
|
40
42
|
* @param errorFactory Custom error factory. Default is `TypeGuardError`
|
|
41
43
|
* @returns The wrapper function with type assertions
|
|
42
|
-
* @throws A {@link TypeGuardError} or a custom error generated by
|
|
43
|
-
*
|
|
44
|
-
* @author Jeongho Nam - https://github.com/samchon
|
|
44
|
+
* @throws A {@link TypeGuardError} or a custom error generated by _errorFactory_
|
|
45
45
|
*/
|
|
46
46
|
export function assertFunction<T extends (...args: any[]) => any>(
|
|
47
47
|
func: T,
|
|
48
48
|
errorFactory?: undefined | ((props: TypeGuardError.IProps) => Error),
|
|
49
49
|
): T;
|
|
50
50
|
|
|
51
|
-
/**
|
|
52
|
-
* @internal
|
|
53
|
-
*/
|
|
51
|
+
/** @internal */
|
|
54
52
|
export function assertFunction(): never {
|
|
55
53
|
NoTransformConfigurationError("functional.assertFunction");
|
|
56
54
|
}
|
|
@@ -58,39 +56,37 @@ export function assertFunction(): never {
|
|
|
58
56
|
/**
|
|
59
57
|
* Asserts parameters.
|
|
60
58
|
*
|
|
61
|
-
* Asserts a function, by wrapping the function and checking its parameters
|
|
62
|
-
* {@link assert} function. If some parameter does not match the expected
|
|
63
|
-
* throws an {@link TypeGuardError} or a custom error generated by the
|
|
64
|
-
* parameter.
|
|
59
|
+
* Asserts a function, by wrapping the function and checking its parameters
|
|
60
|
+
* through {@link assert} function. If some parameter does not match the expected
|
|
61
|
+
* type, it throws an {@link TypeGuardError} or a custom error generated by the
|
|
62
|
+
* _errorFactory_ parameter.
|
|
65
63
|
*
|
|
66
|
-
* For reference, {@link TypeGuardError.path} would be a little bit different
|
|
67
|
-
* individual {@link assert} function. If the {@link TypeGuardError} occurs
|
|
68
|
-
* some parameter, the path would start from `$input.parameters[number]`.
|
|
64
|
+
* For reference, {@link TypeGuardError.path} would be a little bit different
|
|
65
|
+
* with individual {@link assert} function. If the {@link TypeGuardError} occurs
|
|
66
|
+
* from some parameter, the path would start from `$input.parameters[number]`.
|
|
69
67
|
*
|
|
70
68
|
* By the way, if what you want is not just finding the 1st type error through
|
|
71
|
-
* assertion, but also finding every type errors, then use
|
|
72
|
-
* instead. Otherwise, what you want is not only
|
|
73
|
-
* asserting return value, you can use
|
|
69
|
+
* assertion, but also finding every type errors, then use
|
|
70
|
+
* {@link validateParameters} instead. Otherwise, what you want is not only
|
|
71
|
+
* asserting parameters, but also asserting return value, you can use
|
|
72
|
+
* {@link assertFunction} instead.
|
|
74
73
|
*
|
|
75
74
|
* On the other hand, if don't want to allow any superfluous properties, utilize
|
|
76
75
|
* {@link assertEqualsParameters} or {@link validateEqualsParameters} instead.
|
|
77
76
|
*
|
|
77
|
+
* @author Jeongho Nam - https://github.com/samchon
|
|
78
78
|
* @template T Target function type
|
|
79
79
|
* @param func Target function to assert
|
|
80
80
|
* @param errorFactory Custom error factory. Default is `TypeGuardError`
|
|
81
81
|
* @returns The wrapper function with type assertions
|
|
82
|
-
* @throws A {@link TypeGuardError} or a custom error generated by
|
|
83
|
-
*
|
|
84
|
-
* @author Jeongho Nam - https://github.com/samchon
|
|
82
|
+
* @throws A {@link TypeGuardError} or a custom error generated by _errorFactory_
|
|
85
83
|
*/
|
|
86
84
|
export function assertParameters<T extends (...args: any[]) => any>(
|
|
87
85
|
func: T,
|
|
88
86
|
errorFactory?: undefined | ((props: TypeGuardError.IProps) => Error),
|
|
89
87
|
): T;
|
|
90
88
|
|
|
91
|
-
/**
|
|
92
|
-
* @internal
|
|
93
|
-
*/
|
|
89
|
+
/** @internal */
|
|
94
90
|
export function assertParameters(): never {
|
|
95
91
|
NoTransformConfigurationError("functional.assertParameters");
|
|
96
92
|
}
|
|
@@ -98,39 +94,36 @@ export function assertParameters(): never {
|
|
|
98
94
|
/**
|
|
99
95
|
* Asserts return value.
|
|
100
96
|
*
|
|
101
|
-
* Asserts a function, by wrapping the function and checking its return value
|
|
102
|
-
* {@link assert} function. If the return value does not match the
|
|
103
|
-
* throws an {@link TypeGuardError} or a custom error generated
|
|
104
|
-
* parameter.
|
|
97
|
+
* Asserts a function, by wrapping the function and checking its return value
|
|
98
|
+
* through {@link assert} function. If the return value does not match the
|
|
99
|
+
* expected type, it throws an {@link TypeGuardError} or a custom error generated
|
|
100
|
+
* by the _errorFactory_ parameter.
|
|
105
101
|
*
|
|
106
|
-
* For reference, {@link TypeGuardError.path} would be a little bit different
|
|
107
|
-
* individual {@link assert} function. If the {@link TypeGuardError} occurs
|
|
108
|
-
* the return value, the path would start from `$input.return`.
|
|
102
|
+
* For reference, {@link TypeGuardError.path} would be a little bit different
|
|
103
|
+
* with individual {@link assert} function. If the {@link TypeGuardError} occurs
|
|
104
|
+
* from the return value, the path would start from `$input.return`.
|
|
109
105
|
*
|
|
110
106
|
* By the way, if what you want is not just finding the 1st type error through
|
|
111
107
|
* assertion, but also finding every type errors, then use {@link validateReturn}
|
|
112
|
-
* instead. Otherwise, what you want is not only asserting return value, but
|
|
113
|
-
* asserting parameters, you can use {@link assertFunction} instead.
|
|
108
|
+
* instead. Otherwise, what you want is not only asserting return value, but
|
|
109
|
+
* also asserting parameters, you can use {@link assertFunction} instead.
|
|
114
110
|
*
|
|
115
111
|
* On the other hand, if don't want to allow any superfluous properties, utilize
|
|
116
112
|
* {@link assertEqualsReturn} or {@link validateEqualsReturn} instead.
|
|
117
113
|
*
|
|
114
|
+
* @author Jeongho Nam - https://github.com/samchon
|
|
118
115
|
* @template T Target function type
|
|
119
116
|
* @param func Target function to assert
|
|
120
117
|
* @param errorFactory Custom error factory. Default is `TypeGuardError`
|
|
121
118
|
* @returns The wrapper function with type assertions
|
|
122
|
-
* @throws A {@link TypeGuardError} or a custom error generated by
|
|
123
|
-
*
|
|
124
|
-
* @author Jeongho Nam - https://github.com/samchon
|
|
119
|
+
* @throws A {@link TypeGuardError} or a custom error generated by _errorFactory_
|
|
125
120
|
*/
|
|
126
121
|
export function assertReturn<T extends (...args: any[]) => any>(
|
|
127
122
|
func: T,
|
|
128
123
|
errorFactory?: undefined | ((props: TypeGuardError.IProps) => Error),
|
|
129
124
|
): T;
|
|
130
125
|
|
|
131
|
-
/**
|
|
132
|
-
* @internal
|
|
133
|
-
*/
|
|
126
|
+
/** @internal */
|
|
134
127
|
export function assertReturn(): never {
|
|
135
128
|
NoTransformConfigurationError("functional.assertReturn");
|
|
136
129
|
}
|
|
@@ -138,44 +131,43 @@ export function assertReturn(): never {
|
|
|
138
131
|
/**
|
|
139
132
|
* Asserts a function with strict equality.
|
|
140
133
|
*
|
|
141
|
-
* Asserts a function with strict equality, by wrapping the function and
|
|
142
|
-
* its parameters and return value through {@link assertEquals}
|
|
143
|
-
* parameter or return value does not match the expected type,
|
|
144
|
-
* {@link TypeGuardError} or a custom error generated by the
|
|
134
|
+
* Asserts a function with strict equality, by wrapping the function and
|
|
135
|
+
* checking its parameters and return value through {@link assertEquals}
|
|
136
|
+
* function. If some parameter or return value does not match the expected type,
|
|
137
|
+
* it throws an {@link TypeGuardError} or a custom error generated by the
|
|
138
|
+
* _errorFactory_ parameter.
|
|
145
139
|
*
|
|
146
|
-
* For reference, {@link TypeGuardError.path} would be a little bit different
|
|
147
|
-
* individual {@link assertEquals} function. If the {@link TypeGuardError}
|
|
148
|
-
* some parameter, the path would start from
|
|
149
|
-
* the path would start from
|
|
140
|
+
* For reference, {@link TypeGuardError.path} would be a little bit different
|
|
141
|
+
* with individual {@link assertEquals} function. If the {@link TypeGuardError}
|
|
142
|
+
* occurs from some parameter, the path would start from
|
|
143
|
+
* `$input.parameters[number]`. Otherwise the path would start from
|
|
144
|
+
* `$input.return`.
|
|
150
145
|
*
|
|
151
146
|
* - `$input.parameters[0].~`
|
|
152
147
|
* - `$input.return.~`
|
|
153
148
|
*
|
|
154
149
|
* By the way, if what you want is not just finding the 1st type error through
|
|
155
150
|
* assertion, but also finding every type errors, then use
|
|
156
|
-
* {@link validateEqualsFunction} instead. Otherwise, what you want is just
|
|
157
|
-
* parameters or return value only, you can use
|
|
158
|
-
* {@link assertEqualsReturn} instead.
|
|
151
|
+
* {@link validateEqualsFunction} instead. Otherwise, what you want is just
|
|
152
|
+
* asserting parameters or return value only, you can use
|
|
153
|
+
* {@link assertEqualsParameters} or {@link assertEqualsReturn} instead.
|
|
159
154
|
*
|
|
160
155
|
* On the other hand, if you want to allow any superfluous properties, utilize
|
|
161
156
|
* {@link assertFunction} or {@link validateFunction} instead.
|
|
162
157
|
*
|
|
158
|
+
* @author Jeongho Nam - https://github.com/samchon
|
|
163
159
|
* @template T Target function type
|
|
164
160
|
* @param func Target function to assert
|
|
165
161
|
* @param errorFactory Custom error factory. Default is `TypeGuardError`
|
|
166
162
|
* @returns The wrapper function with type assertions
|
|
167
|
-
* @throws A {@link TypeGuardError} or a custom error generated by
|
|
168
|
-
*
|
|
169
|
-
* @author Jeongho Nam - https://github.com/samchon
|
|
163
|
+
* @throws A {@link TypeGuardError} or a custom error generated by _errorFactory_
|
|
170
164
|
*/
|
|
171
165
|
export function assertEqualsFunction<T extends (...args: any[]) => any>(
|
|
172
166
|
func: T,
|
|
173
167
|
errorFactory?: undefined | ((props: TypeGuardError.IProps) => Error),
|
|
174
168
|
): T;
|
|
175
169
|
|
|
176
|
-
/**
|
|
177
|
-
* @internal
|
|
178
|
-
*/
|
|
170
|
+
/** @internal */
|
|
179
171
|
export function assertEqualsFunction(): never {
|
|
180
172
|
NoTransformConfigurationError("functional.assertEqualsFunction");
|
|
181
173
|
}
|
|
@@ -183,14 +175,15 @@ export function assertEqualsFunction(): never {
|
|
|
183
175
|
/**
|
|
184
176
|
* Asserts parameters with strict equality.
|
|
185
177
|
*
|
|
186
|
-
* Asserts a function, by wrapping the function and checking its parameters
|
|
187
|
-
* {@link assertEquals} function. If some parameter does not match the
|
|
188
|
-
* it throws an {@link TypeGuardError} or a custom error generated
|
|
189
|
-
* parameter.
|
|
178
|
+
* Asserts a function, by wrapping the function and checking its parameters
|
|
179
|
+
* through {@link assertEquals} function. If some parameter does not match the
|
|
180
|
+
* expected type, it throws an {@link TypeGuardError} or a custom error generated
|
|
181
|
+
* by the _errorFactory_ parameter.
|
|
190
182
|
*
|
|
191
|
-
* For reference, {@link TypeGuardError.path} would be a little bit different
|
|
192
|
-
* individual {@link assertEquals} function. If the {@link TypeGuardError}
|
|
193
|
-
* some parameter, the path would start from
|
|
183
|
+
* For reference, {@link TypeGuardError.path} would be a little bit different
|
|
184
|
+
* with individual {@link assertEquals} function. If the {@link TypeGuardError}
|
|
185
|
+
* occurs from some parameter, the path would start from
|
|
186
|
+
* `$input.parameters[number]`.
|
|
194
187
|
*
|
|
195
188
|
* By the way, if what you want is not just finding the 1st type error through
|
|
196
189
|
* assertion, but also finding every type errors, then use
|
|
@@ -201,22 +194,19 @@ export function assertEqualsFunction(): never {
|
|
|
201
194
|
* On the other hand, if you want to allow any superfluous properties, utilize
|
|
202
195
|
* {@link assertParameters} or {@link validateParameters} instead.
|
|
203
196
|
*
|
|
197
|
+
* @author Jeongho Nam - https://github.com/samchon
|
|
204
198
|
* @template T Target function type
|
|
205
199
|
* @param func Target function to assert
|
|
206
200
|
* @param errorFactory Custom error factory. Default is `TypeGuardError`
|
|
207
201
|
* @returns The wrapper function with type assertions
|
|
208
|
-
* @throws A {@link TypeGuardError} or a custom error generated by
|
|
209
|
-
*
|
|
210
|
-
* @author Jeongho Nam - https://github.com/samchon
|
|
202
|
+
* @throws A {@link TypeGuardError} or a custom error generated by _errorFactory_
|
|
211
203
|
*/
|
|
212
204
|
export function assertEqualsParameters<T extends (...args: any[]) => any>(
|
|
213
205
|
func: T,
|
|
214
206
|
errorFactory?: undefined | ((props: TypeGuardError.IProps) => Error),
|
|
215
207
|
): T;
|
|
216
208
|
|
|
217
|
-
/**
|
|
218
|
-
* @internal
|
|
219
|
-
*/
|
|
209
|
+
/** @internal */
|
|
220
210
|
export function assertEqualsParameters(): never {
|
|
221
211
|
NoTransformConfigurationError("functional.assertEqualsParameters");
|
|
222
212
|
}
|
|
@@ -224,39 +214,37 @@ export function assertEqualsParameters(): never {
|
|
|
224
214
|
/**
|
|
225
215
|
* Asserts return value with strict equality.
|
|
226
216
|
*
|
|
227
|
-
* Asserts a function, by wrapping the function and checking its return value
|
|
228
|
-
* {@link assertEquals} function. If the return value does not match the
|
|
229
|
-
* it throws an {@link TypeGuardError} or a custom error generated
|
|
230
|
-
* parameter.
|
|
217
|
+
* Asserts a function, by wrapping the function and checking its return value
|
|
218
|
+
* through {@link assertEquals} function. If the return value does not match the
|
|
219
|
+
* expected type, it throws an {@link TypeGuardError} or a custom error generated
|
|
220
|
+
* by the _errorFactory_ parameter.
|
|
231
221
|
*
|
|
232
|
-
* For reference, {@link TypeGuardError.path} would be a little bit different
|
|
233
|
-
* individual {@link assertEquals} function. If the {@link TypeGuardError}
|
|
234
|
-
* the return value, the path would start from `$input.return`.
|
|
222
|
+
* For reference, {@link TypeGuardError.path} would be a little bit different
|
|
223
|
+
* with individual {@link assertEquals} function. If the {@link TypeGuardError}
|
|
224
|
+
* occurs from the return value, the path would start from `$input.return`.
|
|
235
225
|
*
|
|
236
226
|
* By the way, if what you want is not just finding the 1st type error through
|
|
237
|
-
* assertion, but also finding every type errors, then use
|
|
238
|
-
* instead. Otherwise, what you want is not only
|
|
239
|
-
* asserting parameters, you can use
|
|
227
|
+
* assertion, but also finding every type errors, then use
|
|
228
|
+
* {@link validateEqualsReturn} instead. Otherwise, what you want is not only
|
|
229
|
+
* asserting return value, but also asserting parameters, you can use
|
|
230
|
+
* {@link assertEqualsFunction} instead.
|
|
240
231
|
*
|
|
241
232
|
* On the other hand, if you want to allow any superfluous properties, utilize
|
|
242
233
|
* {@link assertReturn} or {@link validateReturn} instead.
|
|
243
234
|
*
|
|
235
|
+
* @author Jeongho Nam - https://github.com/samchon
|
|
244
236
|
* @template T Target function type
|
|
245
237
|
* @param func Target function to assert
|
|
246
238
|
* @param errorFactory Custom error factory. Default is `TypeGuardError`
|
|
247
239
|
* @returns The wrapper function with type assertions
|
|
248
|
-
* @throws A {@link TypeGuardError} or a custom error generated by
|
|
249
|
-
*
|
|
250
|
-
* @author Jeongho Nam - https://github.com/samchon
|
|
240
|
+
* @throws A {@link TypeGuardError} or a custom error generated by _errorFactory_
|
|
251
241
|
*/
|
|
252
242
|
export function assertEqualsReturn<T extends (...args: any[]) => any>(
|
|
253
243
|
func: T,
|
|
254
244
|
errorFactory?: undefined | ((props: TypeGuardError.IProps) => Error),
|
|
255
245
|
): T;
|
|
256
246
|
|
|
257
|
-
/**
|
|
258
|
-
* @internal
|
|
259
|
-
*/
|
|
247
|
+
/** @internal */
|
|
260
248
|
export function assertEqualsReturn(): never {
|
|
261
249
|
NoTransformConfigurationError("functional.assertEqualsReturn");
|
|
262
250
|
}
|
|
@@ -280,11 +268,10 @@ export function assertEqualsReturn(): never {
|
|
|
280
268
|
* utilize {@link equalsFunction}, {@link assertEqualsFunction} or
|
|
281
269
|
* {@link validateEqualsFunction} instead.
|
|
282
270
|
*
|
|
271
|
+
* @author Jeongho Nam - https://github.com/samchon
|
|
283
272
|
* @template T Target function type
|
|
284
273
|
* @param func Target function to test
|
|
285
274
|
* @returns The wrapper function with type tests
|
|
286
|
-
*
|
|
287
|
-
* @author Jeongho Nam - https://github.com/samchon
|
|
288
275
|
*/
|
|
289
276
|
export function isFunction<T extends (...args: any[]) => any>(
|
|
290
277
|
func: T,
|
|
@@ -294,9 +281,7 @@ export function isFunction<T extends (...args: any[]) => any>(
|
|
|
294
281
|
: (...args: Arguments) => Output | null
|
|
295
282
|
: never;
|
|
296
283
|
|
|
297
|
-
/**
|
|
298
|
-
* @internal
|
|
299
|
-
*/
|
|
284
|
+
/** @internal */
|
|
300
285
|
export function isFunction(): never {
|
|
301
286
|
NoTransformConfigurationError("functional.isFunction");
|
|
302
287
|
}
|
|
@@ -304,10 +289,10 @@ export function isFunction(): never {
|
|
|
304
289
|
/**
|
|
305
290
|
* Tests parameters.
|
|
306
291
|
*
|
|
307
|
-
* Tests a function, by wrapping the function and checking its parameters
|
|
308
|
-
* {@link is} function. If some parameter does not match the expected
|
|
309
|
-
* returns `null`. Otherwise there's no type error, it returns the
|
|
310
|
-
* function.
|
|
292
|
+
* Tests a function, by wrapping the function and checking its parameters
|
|
293
|
+
* through {@link is} function. If some parameter does not match the expected
|
|
294
|
+
* type, it returns `null`. Otherwise there's no type error, it returns the
|
|
295
|
+
* result of the function.
|
|
311
296
|
*
|
|
312
297
|
* By the way, if you want is not just testing type checking, but also finding
|
|
313
298
|
* detailed type error reason(s), then use {@link assertParameters} or
|
|
@@ -317,11 +302,10 @@ export function isFunction(): never {
|
|
|
317
302
|
* utilize {@link equalsParameters}, {@link assertEqualsParameters} or
|
|
318
303
|
* {@link validateEqualsParameters} instead.
|
|
319
304
|
*
|
|
305
|
+
* @author Jeongho Nam - https://github.com/samchon
|
|
320
306
|
* @template T Target function type
|
|
321
307
|
* @param func Target function to test
|
|
322
308
|
* @returns The wrapper function with type tests
|
|
323
|
-
*
|
|
324
|
-
* @author Jeongho Nam - https://github.com/samchon
|
|
325
309
|
*/
|
|
326
310
|
export function isParameters<T extends (...args: any[]) => any>(
|
|
327
311
|
func: T,
|
|
@@ -331,9 +315,7 @@ export function isParameters<T extends (...args: any[]) => any>(
|
|
|
331
315
|
: (...args: Arguments) => Output | null
|
|
332
316
|
: never;
|
|
333
317
|
|
|
334
|
-
/**
|
|
335
|
-
* @internal
|
|
336
|
-
*/
|
|
318
|
+
/** @internal */
|
|
337
319
|
export function isParameters(): never {
|
|
338
320
|
NoTransformConfigurationError("functional.isParameters");
|
|
339
321
|
}
|
|
@@ -341,10 +323,10 @@ export function isParameters(): never {
|
|
|
341
323
|
/**
|
|
342
324
|
* Tests return value.
|
|
343
325
|
*
|
|
344
|
-
* Tests a function, by wrapping the function and checking its return value
|
|
345
|
-
* {@link is} function. If the return value does not match the expected
|
|
346
|
-
* returns `null`. Otherwise there's no type error, it returns the
|
|
347
|
-
* function.
|
|
326
|
+
* Tests a function, by wrapping the function and checking its return value
|
|
327
|
+
* through {@link is} function. If the return value does not match the expected
|
|
328
|
+
* type, it returns `null`. Otherwise there's no type error, it returns the
|
|
329
|
+
* result of the function.
|
|
348
330
|
*
|
|
349
331
|
* By the way, if you want is not just testing type checking, but also finding
|
|
350
332
|
* detailed type error reason(s), then use {@link assertReturn} or
|
|
@@ -354,11 +336,10 @@ export function isParameters(): never {
|
|
|
354
336
|
* utilize {@link equalsReturn}, {@link assertEqualsReturn} or
|
|
355
337
|
* {@link validateEqualsReturn} instead.
|
|
356
338
|
*
|
|
339
|
+
* @author Jeongho Nam - https://github.com/samchon
|
|
357
340
|
* @template T Target function type
|
|
358
341
|
* @param func Target function to test
|
|
359
342
|
* @returns The wrapper function with type tests
|
|
360
|
-
*
|
|
361
|
-
* @author Jeongho Nam - https://github.com/samchon
|
|
362
343
|
*/
|
|
363
344
|
export function isReturn<T extends (...args: any[]) => any>(
|
|
364
345
|
func: T,
|
|
@@ -368,9 +349,7 @@ export function isReturn<T extends (...args: any[]) => any>(
|
|
|
368
349
|
: (...args: Arguments) => Output | null
|
|
369
350
|
: never;
|
|
370
351
|
|
|
371
|
-
/**
|
|
372
|
-
* @internal
|
|
373
|
-
*/
|
|
352
|
+
/** @internal */
|
|
374
353
|
export function isReturn(): never {
|
|
375
354
|
NoTransformConfigurationError("functional.isReturn");
|
|
376
355
|
}
|
|
@@ -378,10 +357,11 @@ export function isReturn(): never {
|
|
|
378
357
|
/**
|
|
379
358
|
* Tests a function with strict equality.
|
|
380
359
|
*
|
|
381
|
-
* Tests a function with strict equality, by wrapping the function and checking
|
|
382
|
-
* parameters and return value through {@link isEquals} function. If some
|
|
383
|
-
* or return value does not match the expected type, it returns
|
|
384
|
-
* there's no type error, it returns the result of the
|
|
360
|
+
* Tests a function with strict equality, by wrapping the function and checking
|
|
361
|
+
* its parameters and return value through {@link isEquals} function. If some
|
|
362
|
+
* parameter or return value does not match the expected type, it returns
|
|
363
|
+
* `null`. Otherwise there's no type error, it returns the result of the
|
|
364
|
+
* function.
|
|
385
365
|
*
|
|
386
366
|
* By the way, if you want is not just testing type checking, but also finding
|
|
387
367
|
* detailed type error reason(s), then use {@link assertEqualsFunction} or
|
|
@@ -390,11 +370,10 @@ export function isReturn(): never {
|
|
|
390
370
|
* On the other hand, if you want to allow any superfluous properties, utilize
|
|
391
371
|
* {@link isFunction}, {@link assertFunction} or {@link validateFunction} instead.
|
|
392
372
|
*
|
|
373
|
+
* @author Jeongho Nam - https://github.com/samchon
|
|
393
374
|
* @template T Target function type
|
|
394
375
|
* @param func Target function to test
|
|
395
376
|
* @returns The wrapper function with type tests
|
|
396
|
-
*
|
|
397
|
-
* @author Jeongho Nam - https://github.com/samchon
|
|
398
377
|
*/
|
|
399
378
|
export function equalsFunction<T extends (...args: any[]) => any>(
|
|
400
379
|
func: T,
|
|
@@ -404,9 +383,7 @@ export function equalsFunction<T extends (...args: any[]) => any>(
|
|
|
404
383
|
: (...args: Arguments) => Output | null
|
|
405
384
|
: never;
|
|
406
385
|
|
|
407
|
-
/**
|
|
408
|
-
* @internal
|
|
409
|
-
*/
|
|
386
|
+
/** @internal */
|
|
410
387
|
export function equalsFunction(): never {
|
|
411
388
|
NoTransformConfigurationError("functional.equalsFunction");
|
|
412
389
|
}
|
|
@@ -414,20 +391,19 @@ export function equalsFunction(): never {
|
|
|
414
391
|
/**
|
|
415
392
|
* Tests parameters with strict equality.
|
|
416
393
|
*
|
|
417
|
-
* Tests a function, by wrapping the function and checking its parameters
|
|
418
|
-
* {@link isEquals} function. If some parameter does not match the
|
|
419
|
-
* it returns `null`. Otherwise there's no type error, it returns
|
|
420
|
-
* function.
|
|
394
|
+
* Tests a function, by wrapping the function and checking its parameters
|
|
395
|
+
* through {@link isEquals} function. If some parameter does not match the
|
|
396
|
+
* expected type, it returns `null`. Otherwise there's no type error, it returns
|
|
397
|
+
* the result of the function.
|
|
421
398
|
*
|
|
422
399
|
* By the way, if you want is not just testing type checking, but also finding
|
|
423
400
|
* detailed type error reason(s), then use {@link assertEqualsParameters} or
|
|
424
401
|
* {@link validateEqualsParameters} instead.
|
|
425
402
|
*
|
|
403
|
+
* @author Jeongho Nam - https://github.com/samchon
|
|
426
404
|
* @template T Target function type
|
|
427
405
|
* @param func Target function to test
|
|
428
406
|
* @returns The wrapper function with type tests
|
|
429
|
-
*
|
|
430
|
-
* @author Jeongho Nam - https://github.com/samchon
|
|
431
407
|
*/
|
|
432
408
|
export function equalsParameters<T extends (...args: any[]) => any>(
|
|
433
409
|
func: T,
|
|
@@ -437,9 +413,7 @@ export function equalsParameters<T extends (...args: any[]) => any>(
|
|
|
437
413
|
: (...args: Arguments) => Output | null
|
|
438
414
|
: never;
|
|
439
415
|
|
|
440
|
-
/**
|
|
441
|
-
* @internal
|
|
442
|
-
*/
|
|
416
|
+
/** @internal */
|
|
443
417
|
export function equalsParameters(): never {
|
|
444
418
|
NoTransformConfigurationError("functional.equalsParameters");
|
|
445
419
|
}
|
|
@@ -447,10 +421,10 @@ export function equalsParameters(): never {
|
|
|
447
421
|
/**
|
|
448
422
|
* Tests return value with strict equality.
|
|
449
423
|
*
|
|
450
|
-
* Tests a function, by wrapping the function and checking its return value
|
|
451
|
-
* {@link isEquals} function. If the return value does not match the
|
|
452
|
-
* it returns `null`. Otherwise there's no type error, it returns
|
|
453
|
-
* function.
|
|
424
|
+
* Tests a function, by wrapping the function and checking its return value
|
|
425
|
+
* through {@link isEquals} function. If the return value does not match the
|
|
426
|
+
* expected type, it returns `null`. Otherwise there's no type error, it returns
|
|
427
|
+
* the result of the function.
|
|
454
428
|
*
|
|
455
429
|
* By the way, if you want is not just testing type checking, but also finding
|
|
456
430
|
* detailed type error reason(s), then use {@link assertEqualsReturn} or
|
|
@@ -459,11 +433,10 @@ export function equalsParameters(): never {
|
|
|
459
433
|
* On the other hand, if you want to allow any superfluous properties, utilize
|
|
460
434
|
* {@link isReturn}, {@link assertReturn} or {@link validateReturn} instead.
|
|
461
435
|
*
|
|
436
|
+
* @author Jeongho Nam - https://github.com/samchon
|
|
462
437
|
* @template T Target function type
|
|
463
438
|
* @param func Target function to test
|
|
464
439
|
* @returns The wrapper function with type tests
|
|
465
|
-
*
|
|
466
|
-
* @author Jeongho Nam - https://github.com/samchon
|
|
467
440
|
*/
|
|
468
441
|
export function equalsReturn<T extends (...args: any[]) => any>(
|
|
469
442
|
func: T,
|
|
@@ -473,9 +446,7 @@ export function equalsReturn<T extends (...args: any[]) => any>(
|
|
|
473
446
|
: (...args: Arguments) => Output | null
|
|
474
447
|
: never;
|
|
475
448
|
|
|
476
|
-
/**
|
|
477
|
-
* @internal
|
|
478
|
-
*/
|
|
449
|
+
/** @internal */
|
|
479
450
|
export function equalsReturn(): never {
|
|
480
451
|
NoTransformConfigurationError("functional.equalsReturn");
|
|
481
452
|
}
|
|
@@ -486,33 +457,34 @@ export function equalsReturn(): never {
|
|
|
486
457
|
/**
|
|
487
458
|
* Validates a function.
|
|
488
459
|
*
|
|
489
|
-
* Validates a function, by wrapping the function and checking its parameters
|
|
490
|
-
* return value through {@link validate} function. If some parameter or
|
|
491
|
-
* does not match the expected type, it returns
|
|
492
|
-
* object. Otherwise there's no type error, it
|
|
493
|
-
* typed object instead.
|
|
460
|
+
* Validates a function, by wrapping the function and checking its parameters
|
|
461
|
+
* and return value through {@link validate} function. If some parameter or
|
|
462
|
+
* return value does not match the expected type, it returns
|
|
463
|
+
* {@link IValidation.IError} typed object. Otherwise there's no type error, it
|
|
464
|
+
* returns {@link IValidation.ISuccess} typed object instead.
|
|
494
465
|
*
|
|
495
|
-
* For reference, {@link IValidation.IError.path} would be a little bit different
|
|
496
|
-
* individual {@link validate} function. If the {@link IValidation.IError}
|
|
497
|
-
* some parameter, the path would start from
|
|
498
|
-
* the path would start from
|
|
466
|
+
* For reference, {@link IValidation.IError.path} would be a little bit different
|
|
467
|
+
* with individual {@link validate} function. If the {@link IValidation.IError}
|
|
468
|
+
* occurs from some parameter, the path would start from
|
|
469
|
+
* `$input.parameters[number]`. Otherwise the path would start from
|
|
470
|
+
* `$input.return`.
|
|
499
471
|
*
|
|
500
472
|
* - `$input.parameters[0].~`
|
|
501
473
|
* - `$input.return.~`
|
|
502
474
|
*
|
|
503
|
-
* By the way, if what you want is not finding every type errors, but just
|
|
504
|
-
* the 1st type error, then use {@link assertFunction} instead.
|
|
505
|
-
* want is just validating parameters or return value only,
|
|
506
|
-
* {@link validateParameters} or {@link validateReturn} instead.
|
|
475
|
+
* By the way, if what you want is not finding every type errors, but just
|
|
476
|
+
* finding the 1st type error, then use {@link assertFunction} instead.
|
|
477
|
+
* Otherwise, what you want is just validating parameters or return value only,
|
|
478
|
+
* you can use {@link validateParameters} or {@link validateReturn} instead.
|
|
507
479
|
*
|
|
508
|
-
* On the other hand, if you don't want to allow any superfluous properties,
|
|
509
|
-
* {@link validateEqualsFunction} or {@link assertEqualsFunction}
|
|
480
|
+
* On the other hand, if you don't want to allow any superfluous properties,
|
|
481
|
+
* utilize {@link validateEqualsFunction} or {@link assertEqualsFunction}
|
|
482
|
+
* instead.
|
|
510
483
|
*
|
|
484
|
+
* @author Jeongho Nam - https://github.com/samchon
|
|
511
485
|
* @template T Target function type
|
|
512
486
|
* @param func Target function to validate
|
|
513
487
|
* @returns The wrapper function with type validations
|
|
514
|
-
*
|
|
515
|
-
* @author Jeongho Nam - https://github.com/samchon
|
|
516
488
|
*/
|
|
517
489
|
export function validateFunction<T extends (...args: any[]) => any>(
|
|
518
490
|
func: T,
|
|
@@ -522,9 +494,7 @@ export function validateFunction<T extends (...args: any[]) => any>(
|
|
|
522
494
|
: (...args: Arguments) => IValidation<Output>
|
|
523
495
|
: never;
|
|
524
496
|
|
|
525
|
-
/**
|
|
526
|
-
* @internal
|
|
527
|
-
*/
|
|
497
|
+
/** @internal */
|
|
528
498
|
export function validateFunction(): never {
|
|
529
499
|
NoTransformConfigurationError("functional.validateFunction");
|
|
530
500
|
}
|
|
@@ -532,28 +502,30 @@ export function validateFunction(): never {
|
|
|
532
502
|
/**
|
|
533
503
|
* Validates parameters.
|
|
534
504
|
*
|
|
535
|
-
* Validates a function, by wrapping the function and checking its parameters
|
|
536
|
-
* {@link validate} function. If some parameter does not match the
|
|
537
|
-
* returns {@link IValidation.IError} typed object. Otherwise
|
|
538
|
-
* it returns {@link IValidation.ISuccess} typed object
|
|
505
|
+
* Validates a function, by wrapping the function and checking its parameters
|
|
506
|
+
* through {@link validate} function. If some parameter does not match the
|
|
507
|
+
* expected type, it returns {@link IValidation.IError} typed object. Otherwise
|
|
508
|
+
* there's no type error, it returns {@link IValidation.ISuccess} typed object
|
|
509
|
+
* instead.
|
|
539
510
|
*
|
|
540
|
-
* For reference, {@link IValidation.IError.path} would be a little bit different
|
|
541
|
-
* individual {@link validate} function. If the {@link IValidation.IError}
|
|
542
|
-
* some parameter, the path would start from
|
|
511
|
+
* For reference, {@link IValidation.IError.path} would be a little bit different
|
|
512
|
+
* with individual {@link validate} function. If the {@link IValidation.IError}
|
|
513
|
+
* occurs from some parameter, the path would start from
|
|
514
|
+
* `$input.parameters[number]`.
|
|
543
515
|
*
|
|
544
|
-
* By the way, if what you want is not finding every type errors, but just
|
|
545
|
-
* the 1st type error, then use {@link assertParameters} instead.
|
|
546
|
-
* want is not only validating parameters, but also
|
|
547
|
-
* use {@link validateFunction} instead.
|
|
516
|
+
* By the way, if what you want is not finding every type errors, but just
|
|
517
|
+
* finding the 1st type error, then use {@link assertParameters} instead.
|
|
518
|
+
* Otherwise, what you want is not only validating parameters, but also
|
|
519
|
+
* validating return value, you can use {@link validateFunction} instead.
|
|
548
520
|
*
|
|
549
|
-
* On the other hand, if you don't want to allow any superfluous properties,
|
|
550
|
-
* {@link validateEqualsParameters} or {@link assertEqualsParameters}
|
|
521
|
+
* On the other hand, if you don't want to allow any superfluous properties,
|
|
522
|
+
* utilize {@link validateEqualsParameters} or {@link assertEqualsParameters}
|
|
523
|
+
* instead.
|
|
551
524
|
*
|
|
525
|
+
* @author Jeongho Nam - https://github.com/samchon
|
|
552
526
|
* @template T Target function type
|
|
553
527
|
* @param func Target function to validate
|
|
554
528
|
* @returns The wrapper function with type validations
|
|
555
|
-
*
|
|
556
|
-
* @author Jeongho Nam - https://github.com/samchon
|
|
557
529
|
*/
|
|
558
530
|
export function validateParameters<T extends (...args: any[]) => any>(
|
|
559
531
|
func: T,
|
|
@@ -563,9 +535,7 @@ export function validateParameters<T extends (...args: any[]) => any>(
|
|
|
563
535
|
: (...args: Arguments) => IValidation<Output>
|
|
564
536
|
: never;
|
|
565
537
|
|
|
566
|
-
/**
|
|
567
|
-
* @internal
|
|
568
|
-
*/
|
|
538
|
+
/** @internal */
|
|
569
539
|
export function validateParameters(): never {
|
|
570
540
|
NoTransformConfigurationError("functional.validateParameters");
|
|
571
541
|
}
|
|
@@ -573,28 +543,28 @@ export function validateParameters(): never {
|
|
|
573
543
|
/**
|
|
574
544
|
* Validates return value.
|
|
575
545
|
*
|
|
576
|
-
* Validates a function, by wrapping the function and checking its return value
|
|
577
|
-
* {@link validate} function. If the return value does not match the
|
|
578
|
-
* returns {@link IValidation.IError} typed object. Otherwise
|
|
579
|
-
* it returns {@link IValidation.ISuccess} typed object
|
|
546
|
+
* Validates a function, by wrapping the function and checking its return value
|
|
547
|
+
* through {@link validate} function. If the return value does not match the
|
|
548
|
+
* expected type, it returns {@link IValidation.IError} typed object. Otherwise
|
|
549
|
+
* there's no type error, it returns {@link IValidation.ISuccess} typed object
|
|
550
|
+
* instead.
|
|
580
551
|
*
|
|
581
|
-
* For reference, {@link IValidation.IError.path} would be a little bit different
|
|
582
|
-
* individual {@link validate} function. If the {@link IValidation.IError}
|
|
583
|
-
* the return value, the path would start from `$input.return`.
|
|
552
|
+
* For reference, {@link IValidation.IError.path} would be a little bit different
|
|
553
|
+
* with individual {@link validate} function. If the {@link IValidation.IError}
|
|
554
|
+
* occurs from the return value, the path would start from `$input.return`.
|
|
584
555
|
*
|
|
585
|
-
* By the way, if what you want is not finding every type errors, but just
|
|
586
|
-
* the 1st type error, then use {@link assertReturn} instead. Otherwise,
|
|
587
|
-
* is not only validating return value, but also validating
|
|
588
|
-
* {@link validateFunction} instead.
|
|
556
|
+
* By the way, if what you want is not finding every type errors, but just
|
|
557
|
+
* finding the 1st type error, then use {@link assertReturn} instead. Otherwise,
|
|
558
|
+
* what you want is not only validating return value, but also validating
|
|
559
|
+
* parameters, you can use {@link validateFunction} instead.
|
|
589
560
|
*
|
|
590
|
-
* On the other hand, if you don't want to allow any superfluous properties,
|
|
591
|
-
* {@link validateEqualsReturn} or {@link assertEqualsReturn} instead.
|
|
561
|
+
* On the other hand, if you don't want to allow any superfluous properties,
|
|
562
|
+
* utilize {@link validateEqualsReturn} or {@link assertEqualsReturn} instead.
|
|
592
563
|
*
|
|
564
|
+
* @author Jeongho Nam - https://github.com/samchon
|
|
593
565
|
* @template T Target function type
|
|
594
566
|
* @param func Target function to validate
|
|
595
567
|
* @returns The wrapper function with type validations
|
|
596
|
-
*
|
|
597
|
-
* @author Jeongho Nam - https://github.com/samchon
|
|
598
568
|
*/
|
|
599
569
|
export function validateReturn<T extends (...args: any[]) => any>(
|
|
600
570
|
func: T,
|
|
@@ -604,9 +574,7 @@ export function validateReturn<T extends (...args: any[]) => any>(
|
|
|
604
574
|
: (...args: Arguments) => IValidation<Output>
|
|
605
575
|
: never;
|
|
606
576
|
|
|
607
|
-
/**
|
|
608
|
-
* @internal
|
|
609
|
-
*/
|
|
577
|
+
/** @internal */
|
|
610
578
|
export function validateReturn(): never {
|
|
611
579
|
NoTransformConfigurationError("functional.validateReturn");
|
|
612
580
|
}
|
|
@@ -614,33 +582,34 @@ export function validateReturn(): never {
|
|
|
614
582
|
/**
|
|
615
583
|
* Validates a function with strict equality.
|
|
616
584
|
*
|
|
617
|
-
* Validates a function with strict equality, by wrapping the function and
|
|
618
|
-
* its parameters and return value through {@link validateEquals}
|
|
619
|
-
* parameter or return value does not match the expected type,
|
|
620
|
-
* {@link IValidation.IError} typed object. Otherwise there's no type
|
|
621
|
-
* returns {@link IValidation.ISuccess} typed object instead.
|
|
585
|
+
* Validates a function with strict equality, by wrapping the function and
|
|
586
|
+
* checking its parameters and return value through {@link validateEquals}
|
|
587
|
+
* function. If some parameter or return value does not match the expected type,
|
|
588
|
+
* it returns {@link IValidation.IError} typed object. Otherwise there's no type
|
|
589
|
+
* error, it returns {@link IValidation.ISuccess} typed object instead.
|
|
622
590
|
*
|
|
623
|
-
* For reference, {@link IValidation.IError.path} would be a little bit different
|
|
624
|
-
* individual {@link validateEquals} function. If the
|
|
625
|
-
* from some parameter, the path would start
|
|
626
|
-
* the path would start from
|
|
591
|
+
* For reference, {@link IValidation.IError.path} would be a little bit different
|
|
592
|
+
* with individual {@link validateEquals} function. If the
|
|
593
|
+
* {@link IValidation.IError} occurs from some parameter, the path would start
|
|
594
|
+
* from `$input.parameters[number]`. Otherwise the path would start from
|
|
595
|
+
* `$input.return`.
|
|
627
596
|
*
|
|
628
597
|
* - `$input.parameters[0].~`
|
|
629
598
|
* - `$input.return.~`
|
|
630
599
|
*
|
|
631
|
-
* By the way, if what you want is not finding every type errors, but just
|
|
632
|
-
* the 1st type error, then use {@link assertEqualsFunction} instead.
|
|
633
|
-
* you want is just validating parameters or return value only,
|
|
634
|
-
* {@link validateEqualsParameters} or {@link validateEqualsReturn}
|
|
600
|
+
* By the way, if what you want is not finding every type errors, but just
|
|
601
|
+
* finding the 1st type error, then use {@link assertEqualsFunction} instead.
|
|
602
|
+
* Otherwise, what you want is just validating parameters or return value only,
|
|
603
|
+
* you can use {@link validateEqualsParameters} or {@link validateEqualsReturn}
|
|
604
|
+
* instead.
|
|
635
605
|
*
|
|
636
606
|
* On the other hand, if you want to allow any superfluous properties, utilize
|
|
637
607
|
* {@link validateFunction} or {@link assertFunction} instead.
|
|
638
608
|
*
|
|
609
|
+
* @author Jeongho Nam - https://github.com/samchon
|
|
639
610
|
* @template T Target function type
|
|
640
611
|
* @param func Target function to validate
|
|
641
612
|
* @returns The wrapper function with type validations
|
|
642
|
-
*
|
|
643
|
-
* @author Jeongho Nam - https://github.com/samchon
|
|
644
613
|
*/
|
|
645
614
|
export function validateEqualsFunction<T extends (...args: any[]) => any>(
|
|
646
615
|
func: T,
|
|
@@ -650,9 +619,7 @@ export function validateEqualsFunction<T extends (...args: any[]) => any>(
|
|
|
650
619
|
: (...args: Arguments) => IValidation<Output>
|
|
651
620
|
: never;
|
|
652
621
|
|
|
653
|
-
/**
|
|
654
|
-
* @internal
|
|
655
|
-
*/
|
|
622
|
+
/** @internal */
|
|
656
623
|
export function validateEqualsFunction(): never {
|
|
657
624
|
NoTransformConfigurationError("functional.validateEqualsFunction");
|
|
658
625
|
}
|
|
@@ -660,28 +627,29 @@ export function validateEqualsFunction(): never {
|
|
|
660
627
|
/**
|
|
661
628
|
* Validates parameters with strict equality.
|
|
662
629
|
*
|
|
663
|
-
* Validates a function, by wrapping the function and checking its parameters
|
|
664
|
-
* {@link validateEquals} function. If some parameter does not match the
|
|
665
|
-
* it returns {@link IValidation.IError} typed object. Otherwise
|
|
666
|
-
* it returns {@link IValidation.ISuccess} typed object
|
|
630
|
+
* Validates a function, by wrapping the function and checking its parameters
|
|
631
|
+
* through {@link validateEquals} function. If some parameter does not match the
|
|
632
|
+
* expected type, it returns {@link IValidation.IError} typed object. Otherwise
|
|
633
|
+
* there's no type error, it returns {@link IValidation.ISuccess} typed object
|
|
634
|
+
* instead.
|
|
667
635
|
*
|
|
668
|
-
* For reference, {@link IValidation.IError.path} would be a little bit different
|
|
669
|
-
* individual {@link validateEquals} function. If the
|
|
670
|
-
* from some parameter, the path would start
|
|
636
|
+
* For reference, {@link IValidation.IError.path} would be a little bit different
|
|
637
|
+
* with individual {@link validateEquals} function. If the
|
|
638
|
+
* {@link IValidation.IError} occurs from some parameter, the path would start
|
|
639
|
+
* from `$input.parameters[number]`.
|
|
671
640
|
*
|
|
672
|
-
* By the way, if what you want is not finding every type errors, but just
|
|
673
|
-
* the 1st type error, then use {@link assertEqualsParameters} instead.
|
|
674
|
-
* what you want is not only validating parameters, but also
|
|
675
|
-
* you can use {@link validateEqualsFunction} instead.
|
|
641
|
+
* By the way, if what you want is not finding every type errors, but just
|
|
642
|
+
* finding the 1st type error, then use {@link assertEqualsParameters} instead.
|
|
643
|
+
* Otherwise, what you want is not only validating parameters, but also
|
|
644
|
+
* validating return value, you can use {@link validateEqualsFunction} instead.
|
|
676
645
|
*
|
|
677
646
|
* On the other hand, if you want to allow any superfluous properties, utilize
|
|
678
647
|
* {@link validateParameters} or {@link assertParameters} instead.
|
|
679
648
|
*
|
|
649
|
+
* @author Jeongho Nam - https://github.com/samchon
|
|
680
650
|
* @template T Target function type
|
|
681
651
|
* @param func Target function to validate
|
|
682
652
|
* @returns The wrapper function with type validations
|
|
683
|
-
*
|
|
684
|
-
* @author Jeongho Nam - https://github.com/samchon
|
|
685
653
|
*/
|
|
686
654
|
export function validateEqualsParameters<T extends (...args: any[]) => any>(
|
|
687
655
|
func: T,
|
|
@@ -691,9 +659,7 @@ export function validateEqualsParameters<T extends (...args: any[]) => any>(
|
|
|
691
659
|
: (...args: Arguments) => IValidation<Output>
|
|
692
660
|
: never;
|
|
693
661
|
|
|
694
|
-
/**
|
|
695
|
-
* @internal
|
|
696
|
-
*/
|
|
662
|
+
/** @internal */
|
|
697
663
|
export function validateEqualsParameters(): never {
|
|
698
664
|
NoTransformConfigurationError("functional.validateEqualsParameters");
|
|
699
665
|
}
|
|
@@ -701,28 +667,29 @@ export function validateEqualsParameters(): never {
|
|
|
701
667
|
/**
|
|
702
668
|
* Validates return value with strict equality.
|
|
703
669
|
*
|
|
704
|
-
* Validates a function, by wrapping the function and checking its return value
|
|
705
|
-
* {@link validateEquals} function. If the return value does not match
|
|
706
|
-
* it returns {@link IValidation.IError} typed object.
|
|
707
|
-
* it returns {@link IValidation.ISuccess} typed
|
|
670
|
+
* Validates a function, by wrapping the function and checking its return value
|
|
671
|
+
* through {@link validateEquals} function. If the return value does not match
|
|
672
|
+
* the expected type, it returns {@link IValidation.IError} typed object.
|
|
673
|
+
* Otherwise there's no type error, it returns {@link IValidation.ISuccess} typed
|
|
674
|
+
* object instead.
|
|
708
675
|
*
|
|
709
|
-
* For reference, {@link IValidation.IError.path} would be a little bit different
|
|
710
|
-
* individual {@link validateEquals} function. If the
|
|
711
|
-
* from the return value, the path would start
|
|
676
|
+
* For reference, {@link IValidation.IError.path} would be a little bit different
|
|
677
|
+
* with individual {@link validateEquals} function. If the
|
|
678
|
+
* {@link IValidation.IError} occurs from the return value, the path would start
|
|
679
|
+
* from `$input.return`.
|
|
712
680
|
*
|
|
713
|
-
* By the way, if what you want is not finding every type errors, but just
|
|
714
|
-
* the 1st type error, then use {@link assertEqualsReturn} instead.
|
|
715
|
-
* want is not only validating return value, but also
|
|
716
|
-
* {@link validateEqualsFunction} instead.
|
|
681
|
+
* By the way, if what you want is not finding every type errors, but just
|
|
682
|
+
* finding the 1st type error, then use {@link assertEqualsReturn} instead.
|
|
683
|
+
* Otherwise, what you want is not only validating return value, but also
|
|
684
|
+
* validating parameters, you can use {@link validateEqualsFunction} instead.
|
|
717
685
|
*
|
|
718
686
|
* On the other hand, if you want to allow any superfluous properties, utilize
|
|
719
687
|
* {@link validateReturn} or {@link assertReturn} instead.
|
|
720
688
|
*
|
|
689
|
+
* @author Jeongho Nam - https://github.com/samchon
|
|
721
690
|
* @template T Target function type
|
|
722
691
|
* @param func Target function to validate
|
|
723
692
|
* @returns The wrapper function with type validations
|
|
724
|
-
*
|
|
725
|
-
* @author Jeongho Nam - https://github.com/samchon
|
|
726
693
|
*/
|
|
727
694
|
export function validateEqualsReturn<T extends (...args: any[]) => any>(
|
|
728
695
|
func: T,
|
|
@@ -732,9 +699,7 @@ export function validateEqualsReturn<T extends (...args: any[]) => any>(
|
|
|
732
699
|
: (...args: Arguments) => IValidation<Output>
|
|
733
700
|
: never;
|
|
734
701
|
|
|
735
|
-
/**
|
|
736
|
-
* @internal
|
|
737
|
-
*/
|
|
702
|
+
/** @internal */
|
|
738
703
|
export function validateEqualsReturn(): never {
|
|
739
704
|
NoTransformConfigurationError("functional.validateEqualsReturn");
|
|
740
705
|
}
|