typia 5.5.8 → 5.5.9
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/tags/ContentMediaType.d.ts +9 -0
- package/lib/tags/ContentMediaType.js +3 -0
- package/lib/tags/ContentMediaType.js.map +1 -0
- package/lib/tags/JsonSchemaPlugin.d.ts +7 -0
- package/lib/tags/JsonSchemaPlugin.js +3 -0
- package/lib/tags/JsonSchemaPlugin.js.map +1 -0
- package/lib/tags/index.d.ts +2 -0
- package/lib/tags/index.js +2 -0
- package/lib/tags/index.js.map +1 -1
- package/package.json +1 -1
- package/src/AssertionGuard.ts +1 -1
- package/src/IRandomGenerator.ts +62 -62
- package/src/IValidation.ts +21 -21
- package/src/TypeGuardError.ts +36 -36
- package/src/executable/TypiaGenerateWizard.ts +83 -83
- package/src/executable/TypiaPatchWizard.ts +42 -42
- package/src/executable/setup/ArgumentParser.ts +43 -43
- package/src/executable/setup/CommandExecutor.ts +8 -8
- package/src/executable/setup/FileRetriever.ts +22 -22
- package/src/executable/setup/PackageManager.ts +71 -71
- package/src/executable/setup/PluginConfigurator.ts +69 -69
- package/src/executable/typia.ts +55 -55
- package/src/factories/CommentFactory.ts +79 -79
- package/src/factories/ExpressionFactory.ts +150 -150
- package/src/factories/IdentifierFactory.ts +70 -70
- package/src/factories/JsonMetadataFactory.ts +53 -53
- package/src/factories/LiteralFactory.ts +47 -47
- package/src/factories/MetadataCollection.ts +260 -260
- package/src/factories/MetadataCommentTagFactory.ts +516 -516
- package/src/factories/MetadataFactory.ts +267 -267
- package/src/factories/MetadataTypeTagFactory.ts +332 -332
- package/src/factories/MetadataTypeTagSchemaFactory.ts +58 -58
- package/src/factories/NumericRangeFactory.ts +72 -72
- package/src/factories/ProtobufFactory.ts +267 -267
- package/src/factories/StatementFactory.ts +72 -72
- package/src/factories/TemplateFactory.ts +56 -56
- package/src/factories/ValueFactory.ts +12 -12
- package/src/factories/internal/metadata/MetadataHelper.ts +15 -15
- package/src/factories/internal/metadata/emend_metadata_atomics.ts +46 -46
- package/src/factories/internal/metadata/emplace_metadata_alias.ts +41 -41
- package/src/factories/internal/metadata/emplace_metadata_array_type.ts +38 -38
- package/src/factories/internal/metadata/emplace_metadata_object.ts +176 -176
- package/src/factories/internal/metadata/emplace_metadata_tuple.ts +57 -57
- package/src/factories/internal/metadata/explore_metadata.ts +28 -28
- package/src/factories/internal/metadata/iterate_metadata_alias.ts +34 -34
- package/src/factories/internal/metadata/iterate_metadata_array.ts +70 -70
- package/src/factories/internal/metadata/iterate_metadata_atomic.ts +62 -62
- package/src/factories/internal/metadata/iterate_metadata_coalesce.ts +33 -33
- package/src/factories/internal/metadata/iterate_metadata_collection.ts +131 -131
- package/src/factories/internal/metadata/iterate_metadata_comment_tags.ts +26 -26
- package/src/factories/internal/metadata/iterate_metadata_constant.ts +48 -48
- package/src/factories/internal/metadata/iterate_metadata_escape.ts +52 -52
- package/src/factories/internal/metadata/iterate_metadata_map.ts +50 -50
- package/src/factories/internal/metadata/iterate_metadata_native.ts +209 -209
- package/src/factories/internal/metadata/iterate_metadata_object.ts +33 -33
- package/src/factories/internal/metadata/iterate_metadata_set.ts +41 -41
- package/src/factories/internal/metadata/iterate_metadata_template.ts +44 -44
- package/src/factories/internal/metadata/iterate_metadata_tuple.ts +37 -37
- package/src/factories/internal/metadata/iterate_metadata_union.ts +27 -27
- package/src/functional/$FormDataReader/index.ts +1 -1
- package/src/functional/$HeadersReader/index.ts +1 -1
- package/src/functional/$ParameterReader/index.ts +1 -1
- package/src/functional/$ProtobufReader.ts +195 -195
- package/src/functional/$ProtobufWriter.ts +150 -150
- package/src/functional/$QueryReader/index.ts +1 -1
- package/src/functional/$any.ts +4 -4
- package/src/functional/$clone.ts +4 -4
- package/src/functional/$convention.ts +37 -37
- package/src/functional/$dictionary.ts +22 -22
- package/src/functional/$every.ts +11 -11
- package/src/functional/$guard.ts +21 -21
- package/src/functional/$is_between.ts +2 -2
- package/src/functional/$join.ts +46 -46
- package/src/functional/$number.ts +12 -12
- package/src/functional/$report.ts +13 -13
- package/src/functional/$rest.ts +3 -3
- package/src/functional/$stoll.ts +8 -8
- package/src/functional/$string.ts +43 -43
- package/src/functional/$strlen.ts +7 -7
- package/src/functional/$tail.ts +5 -5
- package/src/functional/$throws.ts +10 -10
- package/src/functional/$varint.ts +130 -130
- package/src/functional/$zigzag.ts +39 -39
- package/src/functional/IProtobufWriter.ts +18 -18
- package/src/functional/Namespace/functional.ts +5 -5
- package/src/functional/Namespace/http.ts +9 -9
- package/src/functional/Namespace/index.ts +76 -76
- package/src/functional/Namespace/json.ts +15 -15
- package/src/functional/Namespace/misc.ts +14 -14
- package/src/functional/Namespace/notations.ts +23 -23
- package/src/functional/Namespace/protobuf.ts +20 -20
- package/src/functional/is.ts +10 -10
- package/src/functional.ts +872 -872
- package/src/http.ts +1266 -1266
- package/src/index.ts +4 -4
- package/src/json.ts +754 -754
- package/src/misc.ts +757 -757
- package/src/module.ts +1024 -1024
- package/src/notations.ts +1020 -1020
- package/src/programmers/functional/FunctionalAssertFunctionProgrammer.ts +130 -130
- package/src/programmers/functional/FunctionalAssertParametersProgrammer.ts +81 -81
- package/src/programmers/functional/FunctionalAssertReturnProgrammer.ts +77 -77
- package/src/programmers/functional/FunctionalIsFunctionProgrammer.ts +61 -61
- package/src/programmers/functional/FunctionalValidateFunctionProgrammer.ts +113 -113
- package/src/programmers/functional/FunctionalValidateParametersProgrammer.ts +203 -203
- package/src/programmers/functional/FunctionalValidateReturnProgrammer.ts +107 -107
- package/src/programmers/functional/internal/FunctionalGeneralProgrammer.ts +32 -32
- package/src/programmers/helpers/AtomicPredicator.ts +24 -24
- package/src/programmers/helpers/CloneJoiner.ts +130 -130
- package/src/programmers/helpers/FunctionImporeter.ts +1 -1
- package/src/programmers/helpers/FunctionImporter.ts +87 -87
- package/src/programmers/helpers/HttpMetadataUtil.ts +21 -21
- package/src/programmers/helpers/ICheckEntry.ts +13 -13
- package/src/programmers/helpers/IExpressionEntry.ts +12 -12
- package/src/programmers/helpers/NotationJoiner.ts +132 -132
- package/src/programmers/helpers/OptionPredicator.ts +15 -15
- package/src/programmers/helpers/ProtobufUtil.ts +125 -125
- package/src/programmers/helpers/ProtobufWire.ts +34 -34
- package/src/programmers/helpers/PruneJoiner.ts +141 -141
- package/src/programmers/helpers/RandomJoiner.ts +140 -140
- package/src/programmers/helpers/RandomRanger.ts +171 -171
- package/src/programmers/helpers/StringifyJoinder.ts +105 -105
- package/src/programmers/helpers/StringifyPredicator.ts +12 -12
- package/src/programmers/helpers/UnionExplorer.ts +269 -269
- package/src/programmers/helpers/UnionPredicator.ts +77 -77
- package/src/programmers/http/HttpAssertFormDataProgrammer.ts +87 -87
- package/src/programmers/http/HttpAssertHeadersProgrammer.ts +89 -89
- package/src/programmers/http/HttpAssertQueryProgrammer.ts +87 -87
- package/src/programmers/http/HttpIsFormDataProgrammer.ts +90 -90
- package/src/programmers/http/HttpIsHeadersProgrammer.ts +92 -92
- package/src/programmers/http/HttpIsQueryProgrammer.ts +90 -90
- package/src/programmers/http/HttpParameterProgrammer.ts +97 -97
- package/src/programmers/http/HttpValidateFormDataProgrammer.ts +75 -75
- package/src/programmers/http/HttpValidateHeadersProgrammer.ts +77 -77
- package/src/programmers/http/HttpValidateQueryProgrammer.ts +75 -75
- package/src/programmers/internal/JSON_SCHEMA_PREFIX.ts +1 -1
- package/src/programmers/internal/application_alias.ts +74 -74
- package/src/programmers/internal/application_array.ts +63 -63
- package/src/programmers/internal/application_boolean.ts +44 -44
- package/src/programmers/internal/application_default.ts +17 -17
- package/src/programmers/internal/application_default_string.ts +33 -33
- package/src/programmers/internal/application_native.ts +40 -40
- package/src/programmers/internal/application_number.ts +98 -98
- package/src/programmers/internal/application_schema.ts +165 -165
- package/src/programmers/internal/application_string.ts +65 -65
- package/src/programmers/internal/application_templates.ts +24 -24
- package/src/programmers/internal/application_tuple.ts +54 -54
- package/src/programmers/internal/check_array_length.ts +45 -45
- package/src/programmers/internal/check_bigint.ts +49 -49
- package/src/programmers/internal/check_dynamic_properties.ts +211 -211
- package/src/programmers/internal/check_everything.ts +23 -23
- package/src/programmers/internal/check_native.ts +21 -21
- package/src/programmers/internal/check_string.ts +48 -48
- package/src/programmers/internal/check_template.ts +61 -61
- package/src/programmers/internal/check_union_array_like.ts +307 -307
- package/src/programmers/internal/decode_union_object.ts +99 -99
- package/src/programmers/internal/metadata_to_pattern.ts +33 -33
- package/src/programmers/internal/prune_object_properties.ts +60 -60
- package/src/programmers/internal/random_custom.ts +37 -37
- package/src/programmers/internal/stringify_dynamic_properties.ts +157 -157
- package/src/programmers/internal/stringify_native.ts +7 -7
- package/src/programmers/internal/stringify_regular_properties.ts +81 -81
- package/src/programmers/internal/template_to_pattern.ts +15 -15
- package/src/programmers/internal/wrap_metadata_rest_tuple.ts +20 -20
- package/src/programmers/json/JsonAssertParseProgrammer.ts +81 -81
- package/src/programmers/json/JsonAssertStringifyProgrammer.ts +67 -67
- package/src/programmers/json/JsonIsParseProgrammer.ts +81 -81
- package/src/programmers/json/JsonIsStringifyProgrammer.ts +75 -75
- package/src/programmers/json/JsonValidateParseProgrammer.ts +64 -64
- package/src/programmers/json/JsonValidateStringifyProgrammer.ts +83 -83
- package/src/programmers/misc/MiscAssertCloneProgrammer.ts +77 -77
- package/src/programmers/misc/MiscAssertPruneProgrammer.ts +66 -66
- package/src/programmers/misc/MiscIsCloneProgrammer.ts +78 -78
- package/src/programmers/misc/MiscIsPruneProgrammer.ts +66 -66
- package/src/programmers/misc/MiscPruneProgrammer.ts +523 -523
- package/src/programmers/misc/MiscValidateCloneProgrammer.ts +80 -80
- package/src/programmers/misc/MiscValidatePruneProgrammer.ts +73 -73
- package/src/programmers/notations/NotationAssertGeneralProgrammer.ts +70 -70
- package/src/programmers/notations/NotationGeneralProgrammer.ts +647 -647
- package/src/programmers/notations/NotationIsGeneralProgrammer.ts +71 -71
- package/src/programmers/notations/NotationValidateGeneralProgrammer.ts +81 -81
- package/src/programmers/protobuf/ProtobufAssertDecodeProgrammer.ts +87 -87
- package/src/programmers/protobuf/ProtobufAssertEncodeProgrammer.ts +67 -67
- package/src/programmers/protobuf/ProtobufIsDecodeProgrammer.ts +90 -90
- package/src/programmers/protobuf/ProtobufIsEncodeProgrammer.ts +75 -75
- package/src/programmers/protobuf/ProtobufValidateDecodeProgrammer.ts +75 -75
- package/src/programmers/protobuf/ProtobufValidateEncodeProgrammer.ts +83 -83
- package/src/protobuf.ts +999 -999
- package/src/reflect.ts +57 -57
- package/src/schemas/json/IJsonApplication.ts +9 -9
- package/src/schemas/json/IJsonComponents.ts +19 -19
- package/src/schemas/json/IJsonSchema.ts +147 -147
- package/src/schemas/metadata/IJsDocTagInfo.ts +10 -10
- package/src/schemas/metadata/IMetadata.ts +34 -34
- package/src/schemas/metadata/IMetadataAlias.ts +12 -12
- package/src/schemas/metadata/IMetadataApplication.ts +7 -7
- package/src/schemas/metadata/IMetadataArray.ts +7 -7
- package/src/schemas/metadata/IMetadataArrayType.ts +10 -10
- package/src/schemas/metadata/IMetadataAtomic.ts +6 -6
- package/src/schemas/metadata/IMetadataComponents.ts +11 -11
- package/src/schemas/metadata/IMetadataConstant.ts +23 -23
- package/src/schemas/metadata/IMetadataDictionary.ts +11 -11
- package/src/schemas/metadata/IMetadataEntry.ts +6 -6
- package/src/schemas/metadata/IMetadataEscaped.ts +6 -6
- package/src/schemas/metadata/IMetadataObject.ts +13 -13
- package/src/schemas/metadata/IMetadataProperty.ts +9 -9
- package/src/schemas/metadata/IMetadataTuple.ts +7 -7
- package/src/schemas/metadata/IMetadataTupleType.ts +10 -10
- package/src/schemas/metadata/IMetadataTypeTag.ts +16 -16
- package/src/schemas/metadata/Metadata.ts +631 -631
- package/src/schemas/metadata/MetadataAlias.ts +61 -61
- package/src/schemas/metadata/MetadataApplication.ts +44 -44
- package/src/schemas/metadata/MetadataArray.ts +49 -49
- package/src/schemas/metadata/MetadataArrayType.ts +57 -57
- package/src/schemas/metadata/MetadataAtomic.ts +85 -85
- package/src/schemas/metadata/MetadataComponents.ts +98 -98
- package/src/schemas/metadata/MetadataConstant.ts +46 -46
- package/src/schemas/metadata/MetadataEscaped.ts +51 -51
- package/src/schemas/metadata/MetadataObject.ts +154 -154
- package/src/schemas/metadata/MetadataProperty.ts +56 -56
- package/src/schemas/metadata/MetadataTuple.ts +32 -32
- package/src/schemas/metadata/MetadataTupleType.ts +67 -67
- package/src/tags/ContentMediaType.ts +10 -0
- package/src/tags/Default.ts +18 -18
- package/src/tags/ExclusiveMaximum.ts +19 -19
- package/src/tags/ExclusiveMinimum.ts +19 -19
- package/src/tags/Format.ts +16 -16
- package/src/tags/JsonSchemaPlugin.ts +8 -0
- package/src/tags/MaxItems.ts +12 -12
- package/src/tags/MaxLength.ts +12 -12
- package/src/tags/Maximum.ts +18 -18
- package/src/tags/MinItems.ts +12 -12
- package/src/tags/MinLength.ts +12 -12
- package/src/tags/Minimum.ts +18 -18
- package/src/tags/MultipleOf.ts +20 -20
- package/src/tags/Pattern.ts +12 -12
- package/src/tags/TagBase.ts +76 -76
- package/src/tags/index.ts +16 -14
- package/src/tags/internal/FormatCheatSheet.ts +71 -71
- package/src/transform.ts +35 -35
- package/src/transformers/CallExpressionTransformer.ts +496 -496
- package/src/transformers/FileTransformer.ts +91 -91
- package/src/transformers/IProject.ts +15 -15
- package/src/transformers/ITransformOptions.ts +62 -62
- package/src/transformers/ImportTransformer.ts +66 -66
- package/src/transformers/NodeTransformer.ts +13 -13
- package/src/transformers/TransformerError.ts +55 -55
- package/src/transformers/features/CreateIsTransformer.ts +10 -10
- package/src/transformers/features/CreateRandomTransformer.ts +40 -40
- package/src/transformers/features/CreateValidateTransformer.ts +13 -13
- package/src/transformers/features/IsTransformer.ts +10 -10
- package/src/transformers/features/RandomTransformer.ts +44 -44
- package/src/transformers/features/ValidateTransformer.ts +11 -11
- package/src/transformers/features/http/CreateHttpAssertFormDataTransformer.ts +12 -12
- package/src/transformers/features/http/CreateHttpAssertHeadersTransformer.ts +11 -11
- package/src/transformers/features/http/CreateHttpAssertQueryTransformer.ts +9 -9
- package/src/transformers/features/http/CreateHttpFormDataTransformer.ts +9 -9
- package/src/transformers/features/http/CreateHttpHeadersTransformer.ts +9 -9
- package/src/transformers/features/http/CreateHttpIsFormDataTransformer.ts +9 -9
- package/src/transformers/features/http/CreateHttpIsHeadersTransformer.ts +9 -9
- package/src/transformers/features/http/CreateHttpIsQueryTransformer.ts +9 -9
- package/src/transformers/features/http/CreateHttpParameterTransformer.ts +9 -9
- package/src/transformers/features/http/CreateHttpQueryTransformer.ts +9 -9
- package/src/transformers/features/http/CreateHttpValidateFormDataTransformer.ts +12 -12
- package/src/transformers/features/http/CreateHttpValidateHeadersTransformer.ts +12 -12
- package/src/transformers/features/http/CreateHttpValidateQueryTransformer.ts +11 -11
- package/src/transformers/features/http/HttpAssertFormDataTransformer.ts +10 -10
- package/src/transformers/features/http/HttpAssertHeadersTransformer.ts +9 -9
- package/src/transformers/features/http/HttpAssertQueryTransformer.ts +9 -9
- package/src/transformers/features/http/HttpFormDataTransformer.ts +9 -9
- package/src/transformers/features/http/HttpHeadersTransformer.ts +9 -9
- package/src/transformers/features/http/HttpIsFormDataTransformer.ts +9 -9
- package/src/transformers/features/http/HttpIsHeadersTransformer.ts +9 -9
- package/src/transformers/features/http/HttpIsQueryTransformer.ts +9 -9
- package/src/transformers/features/http/HttpParameterTransformer.ts +9 -9
- package/src/transformers/features/http/HttpQueryTransformer.ts +9 -9
- package/src/transformers/features/http/HttpValidateFormDataTransformer.ts +10 -10
- package/src/transformers/features/http/HttpValidateHeadersTransformer.ts +10 -10
- package/src/transformers/features/http/HttpValidateQueryTransformer.ts +9 -9
- package/src/transformers/features/json/JsonApplicationTransformer.ts +133 -133
- package/src/transformers/features/json/JsonAssertParseTransformer.ts +9 -9
- package/src/transformers/features/json/JsonAssertStringifyTransformer.ts +10 -10
- package/src/transformers/features/json/JsonCreateAssertParseTransformer.ts +9 -9
- package/src/transformers/features/json/JsonCreateAssertStringifyTransformer.ts +12 -12
- package/src/transformers/features/json/JsonCreateIsParseTransformer.ts +9 -9
- package/src/transformers/features/json/JsonCreateIsStringifyTransformer.ts +9 -9
- package/src/transformers/features/json/JsonCreateStringifyTransformer.ts +9 -9
- package/src/transformers/features/json/JsonCreateValidateParseTransformer.ts +11 -11
- package/src/transformers/features/json/JsonCreateValidateStringifyProgrammer.ts +12 -12
- package/src/transformers/features/json/JsonIsParseTransformer.ts +9 -9
- package/src/transformers/features/json/JsonIsStringifyTransformer.ts +9 -9
- package/src/transformers/features/json/JsonStringifyTransformer.ts +9 -9
- package/src/transformers/features/json/JsonValidateParseTransformer.ts +9 -9
- package/src/transformers/features/json/JsonValidateStringifyTransformer.ts +10 -10
- package/src/transformers/features/misc/MiscAssertCloneTransformer.ts +9 -9
- package/src/transformers/features/misc/MiscAssertPruneTransformer.ts +9 -9
- package/src/transformers/features/misc/MiscCloneTransformer.ts +9 -9
- package/src/transformers/features/misc/MiscCreateAssertCloneTransformer.ts +9 -9
- package/src/transformers/features/misc/MiscCreateAssertPruneTransformer.ts +9 -9
- package/src/transformers/features/misc/MiscCreateCloneTransformer.ts +9 -9
- package/src/transformers/features/misc/MiscCreateIsCloneTransformer.ts +9 -9
- package/src/transformers/features/misc/MiscCreateIsPruneTransformer.ts +9 -9
- package/src/transformers/features/misc/MiscCreatePruneTransformer.ts +9 -9
- package/src/transformers/features/misc/MiscCreateValidateCloneTransformer.ts +11 -11
- package/src/transformers/features/misc/MiscCreateValidatePruneTransformer.ts +11 -11
- package/src/transformers/features/misc/MiscIsCloneTransformer.ts +9 -9
- package/src/transformers/features/misc/MiscIsPruneTransformer.ts +9 -9
- package/src/transformers/features/misc/MiscLiteralsTransformer.ts +32 -32
- package/src/transformers/features/misc/MiscPruneTransformer.ts +9 -9
- package/src/transformers/features/misc/MiscValidateCloneTransformer.ts +9 -9
- package/src/transformers/features/misc/MiscValidatePruneTransformer.ts +9 -9
- package/src/transformers/features/notations/NotationAssertGeneralTransformer.ts +15 -15
- package/src/transformers/features/notations/NotationCreateAssertGeneralTransformer.ts +15 -15
- package/src/transformers/features/notations/NotationCreateGeneralTransformer.ts +15 -15
- package/src/transformers/features/notations/NotationCreateIsGeneralTransformer.ts +15 -15
- package/src/transformers/features/notations/NotationCreateValidateGeneralTransformer.ts +15 -15
- package/src/transformers/features/notations/NotationGeneralTransformer.ts +11 -11
- package/src/transformers/features/notations/NotationIsGeneralTransformer.ts +15 -15
- package/src/transformers/features/notations/NotationValidateGeneralTransformer.ts +15 -15
- package/src/transformers/features/protobuf/ProtobufAssertDecodeTransformer.ts +10 -10
- package/src/transformers/features/protobuf/ProtobufAssertEncodeTransformer.ts +10 -10
- package/src/transformers/features/protobuf/ProtobufCreateAssertDecodeTransformer.ts +12 -12
- package/src/transformers/features/protobuf/ProtobufCreateAssertEncodeTransformer.ts +12 -12
- package/src/transformers/features/protobuf/ProtobufCreateDecodeTransformer.ts +9 -9
- package/src/transformers/features/protobuf/ProtobufCreateEncodeTransformer.ts +9 -9
- package/src/transformers/features/protobuf/ProtobufCreateIsDecodeTransformer.ts +9 -9
- package/src/transformers/features/protobuf/ProtobufCreateIsEncodeTransformer.ts +9 -9
- package/src/transformers/features/protobuf/ProtobufCreateValidateDecodeTransformer.ts +12 -12
- package/src/transformers/features/protobuf/ProtobufCreateValidateEncodeTransformer.ts +12 -12
- package/src/transformers/features/protobuf/ProtobufDecodeTransformer.ts +9 -9
- package/src/transformers/features/protobuf/ProtobufEncodeTransformer.ts +9 -9
- package/src/transformers/features/protobuf/ProtobufIsDecodeTransformer.ts +9 -9
- package/src/transformers/features/protobuf/ProtobufIsEncodeTransformer.ts +9 -9
- package/src/transformers/features/protobuf/ProtobufMessageTransformer.ts +33 -33
- package/src/transformers/features/protobuf/ProtobufValidateDecodeTransformer.ts +10 -10
- package/src/transformers/features/protobuf/ProtobufValidateEncodeTransformer.ts +10 -10
- package/src/transformers/features/reflect/ReflectMetadataTransformer.ts +63 -63
- package/src/transformers/internal/GenericTransformer.ts +104 -104
- package/src/typings/Atomic.ts +13 -13
- package/src/typings/ClassProperties.ts +5 -5
- package/src/typings/Customizable.ts +5 -5
- package/src/typings/OmitNever.ts +3 -3
- package/src/typings/ProtobufAtomic.ts +19 -19
- package/src/typings/SpecialFields.ts +3 -3
- package/src/typings/ValidationPipe.ts +9 -9
- package/src/typings/Writable.ts +11 -11
- package/src/utils/ArrayUtil.ts +43 -43
- package/src/utils/Escaper.ts +46 -46
- package/src/utils/MapUtil.ts +12 -12
- package/src/utils/NameEncoder.ts +32 -32
- package/src/utils/NamingConvention/NamingConvention.ts +86 -86
- package/src/utils/NamingConvention/index.ts +1 -1
- package/src/utils/PatternUtil.ts +29 -29
- package/src/utils/RandomGenerator/RandomGenerator.ts +105 -105
- package/src/utils/RandomGenerator/index.ts +1 -1
- package/src/utils/Singleton.ts +16 -16
- package/src/utils/StringUtil/StringUtil.ts +7 -7
- package/src/utils/StringUtil/index.ts +1 -1
package/src/misc.ts
CHANGED
|
@@ -1,757 +1,757 @@
|
|
|
1
|
-
/* ===========================================================
|
|
2
|
-
MISCELLAENOUS
|
|
3
|
-
- LITERALS
|
|
4
|
-
- CLONE
|
|
5
|
-
- PRUNE
|
|
6
|
-
- FACTORY FUNCTIONS
|
|
7
|
-
==============================================================
|
|
8
|
-
LITERALS
|
|
9
|
-
----------------------------------------------------------- */
|
|
10
|
-
import * as Namespace from "./functional/Namespace";
|
|
11
|
-
|
|
12
|
-
import { Atomic } from "./typings/Atomic";
|
|
13
|
-
|
|
14
|
-
import { IValidation } from "./IValidation";
|
|
15
|
-
import { Resolved } from "./Resolved";
|
|
16
|
-
import { TypeGuardError } from "./TypeGuardError";
|
|
17
|
-
|
|
18
|
-
/**
|
|
19
|
-
* > You must configure the generic argument `T`.
|
|
20
|
-
*
|
|
21
|
-
* Union literal type to array.
|
|
22
|
-
*
|
|
23
|
-
* Converts a union literal type to an array of its members.
|
|
24
|
-
*
|
|
25
|
-
* ```typescript
|
|
26
|
-
* literals<"A" | "B" | 1>; // ["A", "B", 1]
|
|
27
|
-
* ```
|
|
28
|
-
*
|
|
29
|
-
* @template T Union literal type
|
|
30
|
-
* @return Array of union literal type's members
|
|
31
|
-
*
|
|
32
|
-
* @author Jeongho Nam - https://github.com/samchon
|
|
33
|
-
*/
|
|
34
|
-
export function literals(): never;
|
|
35
|
-
|
|
36
|
-
/**
|
|
37
|
-
* Union literal type to array.
|
|
38
|
-
*
|
|
39
|
-
* Converts a union literal type to an array of its members.
|
|
40
|
-
*
|
|
41
|
-
* ```typescript
|
|
42
|
-
* literals<"A" | "B" | 1>; // ["A", "B", 1]
|
|
43
|
-
* ```
|
|
44
|
-
*
|
|
45
|
-
* @template T Union literal type
|
|
46
|
-
* @return Array of union literal type's members
|
|
47
|
-
*
|
|
48
|
-
* @author Jeongho Nam - https://github.com/samchon
|
|
49
|
-
*/
|
|
50
|
-
export function literals<T extends Atomic.Type | null>(): T[];
|
|
51
|
-
|
|
52
|
-
/**
|
|
53
|
-
* @internal
|
|
54
|
-
*/
|
|
55
|
-
export function literals(): never {
|
|
56
|
-
halt("literals");
|
|
57
|
-
}
|
|
58
|
-
|
|
59
|
-
/* -----------------------------------------------------------
|
|
60
|
-
CLONE
|
|
61
|
-
----------------------------------------------------------- */
|
|
62
|
-
/**
|
|
63
|
-
* Clone a data.
|
|
64
|
-
*
|
|
65
|
-
* Clones an instance following type `T`. If the target *input* value or its member
|
|
66
|
-
* variable contains a class instance having methods, those methods would not be
|
|
67
|
-
* cloned.
|
|
68
|
-
*
|
|
69
|
-
* For reference, this `typia.misc.clone()` function does not validate the input value
|
|
70
|
-
* type. It just believes that the input value is following the type `T`. Therefore,
|
|
71
|
-
* if you can't ensure the input value type, it would be better to call
|
|
72
|
-
* {@link assertClone} function instead.
|
|
73
|
-
*
|
|
74
|
-
* @template T Type of the input value
|
|
75
|
-
* @param input A value to be cloned
|
|
76
|
-
* @return Cloned data
|
|
77
|
-
*
|
|
78
|
-
* @author Jeongho Nam - https://github.com/samchon
|
|
79
|
-
*/
|
|
80
|
-
function clone<T>(input: T): Resolved<T>;
|
|
81
|
-
|
|
82
|
-
/**
|
|
83
|
-
* @internal
|
|
84
|
-
*/
|
|
85
|
-
function clone(): never {
|
|
86
|
-
halt("clone");
|
|
87
|
-
}
|
|
88
|
-
const clonePure = /** @__PURE__ */ Object.assign<typeof clone, {}>(
|
|
89
|
-
clone,
|
|
90
|
-
/** @__PURE__ */ Namespace.misc.clone("clone"),
|
|
91
|
-
);
|
|
92
|
-
export { clonePure as clone };
|
|
93
|
-
|
|
94
|
-
/**
|
|
95
|
-
* Clone a data with type assertion.
|
|
96
|
-
*
|
|
97
|
-
* Clones an instance following type `T`, with type assertion. If the target `input`
|
|
98
|
-
* value or its member variable contains a class instance having methods, those
|
|
99
|
-
* methods would not be cloned.
|
|
100
|
-
*
|
|
101
|
-
* In such reason, when `input` value is not matched with the type `T`, it throws an
|
|
102
|
-
* {@link TypeGuardError} or custom error generated by *errorFactory*. Otherwise,
|
|
103
|
-
* there's no problem on the `input` value, cloned data would be returned.
|
|
104
|
-
*
|
|
105
|
-
* @template T Type of the input value
|
|
106
|
-
* @param input A value to be cloned
|
|
107
|
-
* @param errorFactory Custom error factory. Default is `TypeGuardError`
|
|
108
|
-
* @return Cloned data
|
|
109
|
-
*
|
|
110
|
-
* @author Jeongho Nam - https://github.com/samchon
|
|
111
|
-
*/
|
|
112
|
-
function assertClone<T>(
|
|
113
|
-
input: T,
|
|
114
|
-
errorFactory?: undefined | ((props: TypeGuardError.IProps) => Error),
|
|
115
|
-
): Resolved<T>;
|
|
116
|
-
|
|
117
|
-
/**
|
|
118
|
-
* Clone a data with type assertion.
|
|
119
|
-
*
|
|
120
|
-
* Clones an instance following type `T`, with type assertion. If the target `input`
|
|
121
|
-
* value or its member variable contains a class instance having methods, those
|
|
122
|
-
* methods would not be cloned.
|
|
123
|
-
*
|
|
124
|
-
* In such reason, when `input` value is not matched with the type `T`, it throws an
|
|
125
|
-
* {@link TypeGuardError} or custom error generated by *errorFactory*. Otherwise,
|
|
126
|
-
* there's no problem on the `input` value, cloned data would be returned.
|
|
127
|
-
*
|
|
128
|
-
* @template T Type of the input value
|
|
129
|
-
* @param input A value to be cloned
|
|
130
|
-
* @param errorFactory Custom error factory. Default is `TypeGuardError`
|
|
131
|
-
* @return Cloned data
|
|
132
|
-
*
|
|
133
|
-
* @author Jeongho Nam - https://github.com/samchon
|
|
134
|
-
*/
|
|
135
|
-
function assertClone<T>(
|
|
136
|
-
input: unknown,
|
|
137
|
-
errorFactory?: undefined | ((props: TypeGuardError.IProps) => Error),
|
|
138
|
-
): Resolved<T>;
|
|
139
|
-
|
|
140
|
-
/**
|
|
141
|
-
* @internal
|
|
142
|
-
*/
|
|
143
|
-
function assertClone(): never {
|
|
144
|
-
halt("assertClone");
|
|
145
|
-
}
|
|
146
|
-
const assertClonePure = /** @__PURE__ */ Object.assign<
|
|
147
|
-
typeof assertClone,
|
|
148
|
-
{},
|
|
149
|
-
{}
|
|
150
|
-
>(
|
|
151
|
-
assertClone,
|
|
152
|
-
/** @__PURE__ */ Namespace.assert("misc.assertClone"),
|
|
153
|
-
/** @__PURE__ */ Namespace.misc.clone("assertClone"),
|
|
154
|
-
);
|
|
155
|
-
export { assertClonePure as assertClone };
|
|
156
|
-
|
|
157
|
-
/**
|
|
158
|
-
* Clone a data with type checking.
|
|
159
|
-
*
|
|
160
|
-
* Clones an instance following type `T`, with type checking. If the target `input`
|
|
161
|
-
* value or its member variable contains a class instance having methods, those
|
|
162
|
-
* methods would not be cloned.
|
|
163
|
-
*
|
|
164
|
-
* In such reason, when `input` value is not matched with the type `T`, it returns
|
|
165
|
-
* `null` value instead. Otherwise, there's no problem on the `input` value, cloned
|
|
166
|
-
* data would be returned.
|
|
167
|
-
*
|
|
168
|
-
* @template T Type of the input value
|
|
169
|
-
* @param input A value to be cloned
|
|
170
|
-
* @return Cloned data when exact type, otherwise null
|
|
171
|
-
*
|
|
172
|
-
* @author Jeongho Nam - https://github.com/samchon
|
|
173
|
-
*/
|
|
174
|
-
function isClone<T>(input: T): Resolved<T> | null;
|
|
175
|
-
|
|
176
|
-
/**
|
|
177
|
-
* Clone a data with type checking.
|
|
178
|
-
*
|
|
179
|
-
* Clones an instance following type `T`, with type checking. If the target `input`
|
|
180
|
-
* value or its member variable contains a class instance having methods, those
|
|
181
|
-
* methods would not be cloned.
|
|
182
|
-
*
|
|
183
|
-
* In such reason, when `input` value is not matched with the type `T`, it returns
|
|
184
|
-
* `null` value instead. Otherwise, there's no problem on the `input` value, cloned
|
|
185
|
-
* data would be returned.
|
|
186
|
-
*
|
|
187
|
-
* @template T Type of the input value
|
|
188
|
-
* @param input A value to be cloned
|
|
189
|
-
* @return Cloned data when exact type, otherwise null
|
|
190
|
-
*
|
|
191
|
-
* @author Jeongho Nam - https://github.com/samchon
|
|
192
|
-
*/
|
|
193
|
-
function isClone<T>(input: unknown): Resolved<T> | null;
|
|
194
|
-
|
|
195
|
-
/**
|
|
196
|
-
* @internal
|
|
197
|
-
*/
|
|
198
|
-
function isClone(): never {
|
|
199
|
-
halt("isClone");
|
|
200
|
-
}
|
|
201
|
-
const isClonePure = /** @__PURE__ */ Object.assign<typeof isClone, {}, {}>(
|
|
202
|
-
isClone,
|
|
203
|
-
/** @__PURE__ */ Namespace.is(),
|
|
204
|
-
/** @__PURE__ */ Namespace.misc.clone("isClone"),
|
|
205
|
-
);
|
|
206
|
-
export { isClonePure as isClone };
|
|
207
|
-
|
|
208
|
-
/**
|
|
209
|
-
* Clone a data with detailed type validation.
|
|
210
|
-
*
|
|
211
|
-
* Clones an instance following type `T`, with detailed type validation. If the target
|
|
212
|
-
* `input` value or its member variable contains a class instance having methods,
|
|
213
|
-
* those methods would not be cloned.
|
|
214
|
-
*
|
|
215
|
-
* In such reason, when `input` value is not matched with the type `T`, it returns
|
|
216
|
-
* {@link IValidation.Failure} value. Otherwise, there's no problem on the `input`
|
|
217
|
-
* value, cloned data would be stored in `data` property of the output
|
|
218
|
-
* {@link IValidation.Success} instance.
|
|
219
|
-
*
|
|
220
|
-
* @template T Type of the input value
|
|
221
|
-
* @param input A value to be cloned
|
|
222
|
-
* @returns Validation result with cloned value
|
|
223
|
-
*/
|
|
224
|
-
function validateClone<T>(input: T): IValidation<Resolved<T>>;
|
|
225
|
-
|
|
226
|
-
/**
|
|
227
|
-
* Clone a data with detailed type validation.
|
|
228
|
-
*
|
|
229
|
-
* Clones an instance following type `T`, with detailed type validation. If the target
|
|
230
|
-
* `input` value or its member variable contains a class instance having methods,
|
|
231
|
-
* those methods would not be cloned.
|
|
232
|
-
*
|
|
233
|
-
* In such reason, when `input` value is not matched with the type `T`, it returns
|
|
234
|
-
* {@link IValidation.Failure} value. Otherwise, there's no problem on the `input`
|
|
235
|
-
* value, cloned data would be stored in `data` property of the output
|
|
236
|
-
* {@link IValidation.Success} instance.
|
|
237
|
-
*
|
|
238
|
-
* @template T Type of the input value
|
|
239
|
-
* @param input A value to be cloned
|
|
240
|
-
* @returns Validation result with cloned value
|
|
241
|
-
*/
|
|
242
|
-
function validateClone<T>(input: unknown): IValidation<Resolved<T>>;
|
|
243
|
-
|
|
244
|
-
/**
|
|
245
|
-
* @internal
|
|
246
|
-
*/
|
|
247
|
-
function validateClone(): never {
|
|
248
|
-
halt("validateClone");
|
|
249
|
-
}
|
|
250
|
-
const validateClonePure = /** @__PURE__ */ Object.assign<
|
|
251
|
-
typeof validateClone,
|
|
252
|
-
{},
|
|
253
|
-
{}
|
|
254
|
-
>(
|
|
255
|
-
validateClone,
|
|
256
|
-
/** @__PURE__ */ Namespace.validate(),
|
|
257
|
-
/** @__PURE__ */ Namespace.misc.clone("validateClone"),
|
|
258
|
-
);
|
|
259
|
-
export { validateClonePure as validateClone };
|
|
260
|
-
|
|
261
|
-
/* -----------------------------------------------------------
|
|
262
|
-
PRUNE
|
|
263
|
-
----------------------------------------------------------- */
|
|
264
|
-
/**
|
|
265
|
-
* Prune, erase superfluous properties.
|
|
266
|
-
*
|
|
267
|
-
* Remove every superfluous properties from the `input` object, even including nested
|
|
268
|
-
* objects. Note that, as every superfluous properties would be deleted, you never can
|
|
269
|
-
* read those superfluous properties after calling this `prune()` function.
|
|
270
|
-
*
|
|
271
|
-
* For reference, this `typia.misc.prune()` function does not validate the input value
|
|
272
|
-
* type. It just believes that the input value is following the type `T`. Therefore,
|
|
273
|
-
* if you can't ensure the input value type, it would better to call one of below
|
|
274
|
-
* functions instead.
|
|
275
|
-
*
|
|
276
|
-
* - {@link assertPrune}
|
|
277
|
-
* - {@link isPrune}
|
|
278
|
-
* - {@link validatePrune}
|
|
279
|
-
*
|
|
280
|
-
* @template T Type of the input value
|
|
281
|
-
* @param input Target instance to prune
|
|
282
|
-
*
|
|
283
|
-
* @author Jeongho Nam - https://github.com/samchon
|
|
284
|
-
*/
|
|
285
|
-
function prune<T extends object>(input: T): void;
|
|
286
|
-
|
|
287
|
-
/**
|
|
288
|
-
* @internal
|
|
289
|
-
*/
|
|
290
|
-
function prune(): never {
|
|
291
|
-
halt("prune");
|
|
292
|
-
}
|
|
293
|
-
const prunePure = /** @__PURE__ */ Object.assign<typeof prune, {}>(
|
|
294
|
-
prune,
|
|
295
|
-
/** @__PURE__ */ Namespace.misc.prune("prune"),
|
|
296
|
-
);
|
|
297
|
-
export { prunePure as prune };
|
|
298
|
-
|
|
299
|
-
/**
|
|
300
|
-
* Prune, erase superfluous properties, with type assertion.
|
|
301
|
-
*
|
|
302
|
-
* `typia.misc.assertPrune()` is a combination function of {@link assert} and
|
|
303
|
-
* {@link prune}. Therefore, it removes every superfluous properties from the `input`
|
|
304
|
-
* object including nested objects, with type assertion.
|
|
305
|
-
*
|
|
306
|
-
* In such reason, when `input` value is not matched with the type `T`, it throws an
|
|
307
|
-
* {@link TypeGuardError} or custom error generated by *errorFactory*. Otherwise,
|
|
308
|
-
* there's no problem on the `input` value, its every superfluous properties would be
|
|
309
|
-
* removed, including nested objects.
|
|
310
|
-
*
|
|
311
|
-
* @template T Type of the input value
|
|
312
|
-
* @param input Target instance to assert and prune
|
|
313
|
-
* @param errorFactory Custom error factory. Default is `TypeGuardError`
|
|
314
|
-
*
|
|
315
|
-
* @author Jeongho Nam - https://github.com/samchon
|
|
316
|
-
*/
|
|
317
|
-
function assertPrune<T>(
|
|
318
|
-
input: T,
|
|
319
|
-
errorFactory?: undefined | ((props: TypeGuardError.IProps) => Error),
|
|
320
|
-
): T;
|
|
321
|
-
|
|
322
|
-
/**
|
|
323
|
-
* Prune, erase superfluous properties, with type assertion.
|
|
324
|
-
*
|
|
325
|
-
* `typia.misc.assertPrune()` is a combination function of {@link assert} and
|
|
326
|
-
* {@link prune}. Therefore, it removes every superfluous properties from the `input`
|
|
327
|
-
* object including nested objects, with type assertion.
|
|
328
|
-
*
|
|
329
|
-
* In such reason, when `input` value is not matched with the type `T`, it throws an
|
|
330
|
-
* {@link TypeGuardError} or custom error generated by *errorFactory*. Otherwise, there's
|
|
331
|
-
* no problem on the `input` value, its every superfluous properties would be removed,
|
|
332
|
-
* including nested objects.
|
|
333
|
-
*
|
|
334
|
-
* @template T Type of the input value
|
|
335
|
-
* @param input Target instance to assert and prune
|
|
336
|
-
* @param errorFactory Custom error factory. Default is `TypeGuardError`
|
|
337
|
-
*
|
|
338
|
-
* @author Jeongho Nam - https://github.com/samchon
|
|
339
|
-
*/
|
|
340
|
-
function assertPrune<T>(
|
|
341
|
-
input: unknown,
|
|
342
|
-
errorFactory?: undefined | ((props: TypeGuardError.IProps) => Error),
|
|
343
|
-
): T;
|
|
344
|
-
|
|
345
|
-
/**
|
|
346
|
-
* @internal
|
|
347
|
-
*/
|
|
348
|
-
function assertPrune(): unknown {
|
|
349
|
-
halt("assertPrune");
|
|
350
|
-
}
|
|
351
|
-
const assertPrunePure = /** @__PURE__ */ Object.assign<
|
|
352
|
-
typeof assertPrune,
|
|
353
|
-
{},
|
|
354
|
-
{}
|
|
355
|
-
>(
|
|
356
|
-
assertPrune,
|
|
357
|
-
/** @__PURE__ */ Namespace.assert("misc.assertPrune"),
|
|
358
|
-
/** @__PURE__ */ Namespace.misc.prune("assertPrune"),
|
|
359
|
-
);
|
|
360
|
-
export { assertPrunePure as assertPrune };
|
|
361
|
-
|
|
362
|
-
/**
|
|
363
|
-
* Prune, erase superfluous properties, with type checking.
|
|
364
|
-
*
|
|
365
|
-
* `typia.misc.assertPrune()` is a combination function of {@link is} and
|
|
366
|
-
* {@link prune}. Therefore, it removes every superfluous properties from the `input`
|
|
367
|
-
* object including nested objects, with type checking.
|
|
368
|
-
*
|
|
369
|
-
* In such reason, when `input` value is not matched with the type `T`, it returns
|
|
370
|
-
* `false` value. Otherwise, there's no problem on the `input` value, it returns
|
|
371
|
-
* `true` after removing every superfluous properties, including nested objects.
|
|
372
|
-
*
|
|
373
|
-
* @template T Type of the input value
|
|
374
|
-
* @param input Target instance to check and prune
|
|
375
|
-
* @returns Whether the parametric value is following the type `T` or not
|
|
376
|
-
*
|
|
377
|
-
* @author Jeongho Nam - https://github.com/samchon
|
|
378
|
-
*/
|
|
379
|
-
function isPrune<T>(input: T): input is T;
|
|
380
|
-
|
|
381
|
-
/**
|
|
382
|
-
* Prune, erase superfluous properties, with type checking.
|
|
383
|
-
*
|
|
384
|
-
* `typia.misc.assertPrune()` is a combination function of {@link is} and
|
|
385
|
-
* {@link prune}. Therefore, it removes every superfluous properties from the `input`
|
|
386
|
-
* object including nested objects, with type checking.
|
|
387
|
-
*
|
|
388
|
-
* In such reason, when `input` value is not matched with the type `T`, it returns
|
|
389
|
-
* `false` value. Otherwise, there's no problem on the `input` value, it returns
|
|
390
|
-
* `true` after removing every superfluous properties, including nested objects.
|
|
391
|
-
*
|
|
392
|
-
* @template T Type of the input value
|
|
393
|
-
* @param input Target instance to check and prune
|
|
394
|
-
* @returns Whether the parametric value is following the type `T` or not
|
|
395
|
-
*
|
|
396
|
-
* @author Jeongho Nam - https://github.com/samchon
|
|
397
|
-
*/
|
|
398
|
-
function isPrune<T>(input: unknown): input is T;
|
|
399
|
-
|
|
400
|
-
/**
|
|
401
|
-
* @internal
|
|
402
|
-
*/
|
|
403
|
-
function isPrune(): never {
|
|
404
|
-
halt("isPrune");
|
|
405
|
-
}
|
|
406
|
-
const isPrunePure = /** @__PURE__ */ Object.assign<typeof isPrune, {}, {}>(
|
|
407
|
-
isPrune,
|
|
408
|
-
/** @__PURE__ */ Namespace.is(),
|
|
409
|
-
/** @__PURE__ */ Namespace.misc.prune("isPrune"),
|
|
410
|
-
);
|
|
411
|
-
export { isPrunePure as isPrune };
|
|
412
|
-
|
|
413
|
-
/**
|
|
414
|
-
* Prune, erase superfluous properties, with type validation.
|
|
415
|
-
*
|
|
416
|
-
* `typia.misc.validatePrune()` is a combination function of {@link validate} and
|
|
417
|
-
* {@link prune}. Therefore, it removes every superfluous properties from the `input`
|
|
418
|
-
* object including nested objects, with type validation.
|
|
419
|
-
*
|
|
420
|
-
* In such reason, when `input` value is not matched with the type `T`, it returns
|
|
421
|
-
* {@link IValidation.IFailure} value with detailed error reasons. Otherwise, there's
|
|
422
|
-
* no problem on the `input` value, it returns {@link IValidation.ISucess} value after
|
|
423
|
-
* removing every superfluous properties, including nested objects.
|
|
424
|
-
*
|
|
425
|
-
* @template T Type of the input value
|
|
426
|
-
* @param input Target instance to validate and prune
|
|
427
|
-
* @returns Validation result
|
|
428
|
-
*
|
|
429
|
-
* @author Jeongho Nam - https://github.com/samchon
|
|
430
|
-
*/
|
|
431
|
-
function validatePrune<T>(input: T): IValidation<T>;
|
|
432
|
-
|
|
433
|
-
/**
|
|
434
|
-
* Prune, erase superfluous properties, with type validation.
|
|
435
|
-
*
|
|
436
|
-
* `typia.misc.validatePrune()` is a combination function of {@link validate} and
|
|
437
|
-
* {@link prune}. Therefore, it removes every superfluous properties from the `input`
|
|
438
|
-
* object including nested objects, with type validation.
|
|
439
|
-
*
|
|
440
|
-
* In such reason, when `input` value is not matched with the type `T`, it returns
|
|
441
|
-
* {@link IValidation.IFailure} value with detailed error reasons. Otherwise, there's
|
|
442
|
-
* no problem on the `input` value, it returns {@link IValidation.ISucess} value after
|
|
443
|
-
* removing every superfluous properties, including nested objects.
|
|
444
|
-
*
|
|
445
|
-
* @template T Type of the input value
|
|
446
|
-
* @param input Target instance to validate and prune
|
|
447
|
-
* @returns Validation result
|
|
448
|
-
*
|
|
449
|
-
* @author Jeongho Nam - https://github.com/samchon
|
|
450
|
-
*/
|
|
451
|
-
function validatePrune<T>(input: unknown): IValidation<T>;
|
|
452
|
-
|
|
453
|
-
/**
|
|
454
|
-
* @internal
|
|
455
|
-
*/
|
|
456
|
-
function validatePrune<T>(): IValidation<T> {
|
|
457
|
-
halt("validatePrune");
|
|
458
|
-
}
|
|
459
|
-
|
|
460
|
-
const validatePrunePure = /** @__PURE__ */ Object.assign<
|
|
461
|
-
typeof validatePrune,
|
|
462
|
-
{},
|
|
463
|
-
{}
|
|
464
|
-
>(
|
|
465
|
-
validatePrune,
|
|
466
|
-
/** @__PURE__ */ Namespace.misc.prune("validatePrune"),
|
|
467
|
-
/** @__PURE__ */ Namespace.validate(),
|
|
468
|
-
);
|
|
469
|
-
export { validatePrunePure as validatePrune };
|
|
470
|
-
|
|
471
|
-
/* -----------------------------------------------------------
|
|
472
|
-
FACTORY FUNCTIONS
|
|
473
|
-
----------------------------------------------------------- */
|
|
474
|
-
/**
|
|
475
|
-
* Creates a reusable {@link clone} function.
|
|
476
|
-
*
|
|
477
|
-
* @danger You must configure the generic argument `T`
|
|
478
|
-
* @returns Nothing until you configure the generic argument `T`
|
|
479
|
-
* @throws compile error
|
|
480
|
-
*
|
|
481
|
-
* @author Jeongho Nam - https://github.com/samchon
|
|
482
|
-
*/
|
|
483
|
-
function createClone(): never;
|
|
484
|
-
|
|
485
|
-
/**
|
|
486
|
-
* Creates a resuable {@link clone} function.
|
|
487
|
-
*
|
|
488
|
-
* @template T Type of the input value
|
|
489
|
-
* @returns A reusable `clone` function
|
|
490
|
-
*
|
|
491
|
-
* @author Jeongho Nam - https://github.com/samchon
|
|
492
|
-
*/
|
|
493
|
-
function createClone<T>(): (input: T) => Resolved<T>;
|
|
494
|
-
|
|
495
|
-
/**
|
|
496
|
-
* @internal
|
|
497
|
-
*/
|
|
498
|
-
function createClone(): never {
|
|
499
|
-
halt("createClone");
|
|
500
|
-
}
|
|
501
|
-
const createClonePure = /** @__PURE__ */ Object.assign<typeof createClone, {}>(
|
|
502
|
-
createClone,
|
|
503
|
-
clonePure,
|
|
504
|
-
);
|
|
505
|
-
export { createClonePure as createClone };
|
|
506
|
-
|
|
507
|
-
/**
|
|
508
|
-
* Creates a reusable {@link assertClone} function.
|
|
509
|
-
*
|
|
510
|
-
* @danger You must configure the generic argument `T`
|
|
511
|
-
* @param errorFactory Custom error factory. Default is `TypeGuardError`
|
|
512
|
-
* @returns Nothing until you configure the generic argument `T`
|
|
513
|
-
* @throws compile error
|
|
514
|
-
*
|
|
515
|
-
* @author Jeongho Nam - https://github.com/samchon
|
|
516
|
-
*/
|
|
517
|
-
function createAssertClone(
|
|
518
|
-
errorFactory?: undefined | ((props: TypeGuardError.IProps) => Error),
|
|
519
|
-
): never;
|
|
520
|
-
|
|
521
|
-
/**
|
|
522
|
-
* Creates a resuable {@link assertClone} function.
|
|
523
|
-
*
|
|
524
|
-
* @template T Type of the input value
|
|
525
|
-
* @param errorFactory Custom error factory. Default is `TypeGuardError`
|
|
526
|
-
* @returns A reusable `clone` function
|
|
527
|
-
*
|
|
528
|
-
* @author Jeongho Nam - https://github.com/samchon
|
|
529
|
-
*/
|
|
530
|
-
function createAssertClone<T>(
|
|
531
|
-
errorFactory?: undefined | ((props: TypeGuardError.IProps) => Error),
|
|
532
|
-
): (input: unknown) => Resolved<T>;
|
|
533
|
-
|
|
534
|
-
/**
|
|
535
|
-
* @internal
|
|
536
|
-
*/
|
|
537
|
-
function createAssertClone(): never {
|
|
538
|
-
halt("createAssertClone");
|
|
539
|
-
}
|
|
540
|
-
const createAssertClonePure = /** @__PURE__ */ Object.assign<
|
|
541
|
-
typeof createAssertClone,
|
|
542
|
-
{}
|
|
543
|
-
>(createAssertClone, assertClonePure);
|
|
544
|
-
export { createAssertClonePure as createAssertClone };
|
|
545
|
-
|
|
546
|
-
/**
|
|
547
|
-
* Creates a reusable {@link isClone} function.
|
|
548
|
-
*
|
|
549
|
-
* @danger You must configure the generic argument `T`
|
|
550
|
-
* @returns Nothing until you configure the generic argument `T`
|
|
551
|
-
* @throws compile error
|
|
552
|
-
*
|
|
553
|
-
* @author Jeongho Nam - https://github.com/samchon
|
|
554
|
-
*/
|
|
555
|
-
function createIsClone(): never;
|
|
556
|
-
|
|
557
|
-
/**
|
|
558
|
-
* Creates a resuable {@link isClone} function.
|
|
559
|
-
*
|
|
560
|
-
* @template T Type of the input value
|
|
561
|
-
* @returns A reusable `clone` function
|
|
562
|
-
*
|
|
563
|
-
* @author Jeongho Nam - https://github.com/samchon
|
|
564
|
-
*/
|
|
565
|
-
function createIsClone<T>(): (input: unknown) => Resolved<T> | null;
|
|
566
|
-
|
|
567
|
-
/**
|
|
568
|
-
* @internal
|
|
569
|
-
*/
|
|
570
|
-
function createIsClone(): never {
|
|
571
|
-
halt("createIsClone");
|
|
572
|
-
}
|
|
573
|
-
const createIsClonePure = /** @__PURE__ */ Object.assign<
|
|
574
|
-
typeof createIsClone,
|
|
575
|
-
{}
|
|
576
|
-
>(createIsClone, isClonePure);
|
|
577
|
-
export { createIsClonePure as createIsClone };
|
|
578
|
-
|
|
579
|
-
/**
|
|
580
|
-
* Creates a reusable {@link validateClone} function.
|
|
581
|
-
*
|
|
582
|
-
* @danger You must configure the generic argument `T`
|
|
583
|
-
* @returns Nothing until you configure the generic argument `T`
|
|
584
|
-
* @throws compile error
|
|
585
|
-
*
|
|
586
|
-
* @author Jeongho Nam - https://github.com/samchon
|
|
587
|
-
*/
|
|
588
|
-
function createValidateClone(): never;
|
|
589
|
-
|
|
590
|
-
/**
|
|
591
|
-
* Creates a resuable {@link validateClone} function.
|
|
592
|
-
*
|
|
593
|
-
* @template T Type of the input value
|
|
594
|
-
* @returns A reusable `clone` function
|
|
595
|
-
*
|
|
596
|
-
* @author Jeongho Nam - https://github.com/samchon
|
|
597
|
-
*/
|
|
598
|
-
function createValidateClone<T>(): (input: unknown) => IValidation<Resolved<T>>;
|
|
599
|
-
|
|
600
|
-
/**
|
|
601
|
-
* @internal
|
|
602
|
-
*/
|
|
603
|
-
function createValidateClone(): never {
|
|
604
|
-
halt("createValidateClone");
|
|
605
|
-
}
|
|
606
|
-
const createValidateClonePure = /** @__PURE__ */ Object.assign<
|
|
607
|
-
typeof createValidateClone,
|
|
608
|
-
{}
|
|
609
|
-
>(createValidateClone, validateClonePure);
|
|
610
|
-
export { createValidateClonePure as createValidateClone };
|
|
611
|
-
|
|
612
|
-
/**
|
|
613
|
-
* Creates a reusable {@link prune} function.
|
|
614
|
-
*
|
|
615
|
-
* @danger You must configure the generic argument `T`
|
|
616
|
-
* @returns Nothing until you configure the generic argument `T`
|
|
617
|
-
* @throws compile error
|
|
618
|
-
*
|
|
619
|
-
* @author Jeongho Nam - https://github.com/samchon
|
|
620
|
-
*/
|
|
621
|
-
function createPrune(): never;
|
|
622
|
-
|
|
623
|
-
/**
|
|
624
|
-
* Creates a resuable {@link prune} function.
|
|
625
|
-
*
|
|
626
|
-
* @template T Type of the input value
|
|
627
|
-
* @returns A reusable `prune` function
|
|
628
|
-
*
|
|
629
|
-
* @author Jeongho Nam - https://github.com/samchon
|
|
630
|
-
*/
|
|
631
|
-
function createPrune<T extends object>(): (input: T) => void;
|
|
632
|
-
|
|
633
|
-
/**
|
|
634
|
-
* @internal
|
|
635
|
-
*/
|
|
636
|
-
function createPrune<T extends object>(): (input: T) => void {
|
|
637
|
-
halt("createPrune");
|
|
638
|
-
}
|
|
639
|
-
const createPrunePure = /** @__PURE__ */ Object.assign<typeof createPrune, {}>(
|
|
640
|
-
createPrune,
|
|
641
|
-
prunePure,
|
|
642
|
-
);
|
|
643
|
-
export { createPrunePure as createPrune };
|
|
644
|
-
|
|
645
|
-
/**
|
|
646
|
-
* Creates a reusable {@link assertPrune} function.
|
|
647
|
-
*
|
|
648
|
-
* @danger You must configure the generic argument `T`
|
|
649
|
-
* @param errorFactory Custom error factory. Default is `TypeGuardError`
|
|
650
|
-
* @returns Nothing until you configure the generic argument `T`
|
|
651
|
-
* @throws compile error
|
|
652
|
-
*
|
|
653
|
-
* @author Jeongho Nam - https://github.com/samchon
|
|
654
|
-
*/
|
|
655
|
-
function createAssertPrune(
|
|
656
|
-
errorFactory?: undefined | ((props: TypeGuardError.IProps) => Error),
|
|
657
|
-
): never;
|
|
658
|
-
|
|
659
|
-
/**
|
|
660
|
-
* Creates a resuable {@link assertPrune} function.
|
|
661
|
-
*
|
|
662
|
-
* @template T Type of the input value
|
|
663
|
-
* @param errorFactory Custom error factory. Default is `TypeGuardError`
|
|
664
|
-
* @returns A reusable `isPrune` function
|
|
665
|
-
*
|
|
666
|
-
* @author Jeongho Nam - https://github.com/samchon
|
|
667
|
-
*/
|
|
668
|
-
function createAssertPrune<T extends object>(
|
|
669
|
-
errorFactory?: undefined | ((props: TypeGuardError.IProps) => Error),
|
|
670
|
-
): (input: T) => T;
|
|
671
|
-
|
|
672
|
-
/**
|
|
673
|
-
* @internal
|
|
674
|
-
*/
|
|
675
|
-
function createAssertPrune<T extends object>(): (input: T) => T {
|
|
676
|
-
halt("createAssertPrune");
|
|
677
|
-
}
|
|
678
|
-
const createAssertPrunePure = /** @__PURE__ */ Object.assign<
|
|
679
|
-
typeof createAssertPrune,
|
|
680
|
-
{}
|
|
681
|
-
>(createAssertPrune, assertPrunePure);
|
|
682
|
-
export { createAssertPrunePure as createAssertPrune };
|
|
683
|
-
|
|
684
|
-
/**
|
|
685
|
-
* Creates a reusable {@link isPrune} function.
|
|
686
|
-
*
|
|
687
|
-
* @danger You must configure the generic argument `T`
|
|
688
|
-
* @returns Nothing until you configure the generic argument `T`
|
|
689
|
-
* @throws compile error
|
|
690
|
-
*
|
|
691
|
-
* @author Jeongho Nam - https://github.com/samchon
|
|
692
|
-
*/
|
|
693
|
-
function createIsPrune(): never;
|
|
694
|
-
|
|
695
|
-
/**
|
|
696
|
-
* Creates a resuable {@link isPrune} function.
|
|
697
|
-
*
|
|
698
|
-
* @template T Type of the input value
|
|
699
|
-
* @returns A reusable `isPrune` function
|
|
700
|
-
*
|
|
701
|
-
* @author Jeongho Nam - https://github.com/samchon
|
|
702
|
-
*/
|
|
703
|
-
function createIsPrune<T extends object>(): (input: T) => input is T;
|
|
704
|
-
|
|
705
|
-
/**
|
|
706
|
-
* @internal
|
|
707
|
-
*/
|
|
708
|
-
function createIsPrune<T extends object>(): (input: T) => input is T {
|
|
709
|
-
halt("createIsPrune");
|
|
710
|
-
}
|
|
711
|
-
const createIsPrunePure = /** @__PURE__ */ Object.assign<
|
|
712
|
-
typeof createIsPrune,
|
|
713
|
-
{}
|
|
714
|
-
>(createIsPrune, isPrunePure);
|
|
715
|
-
export { createIsPrunePure as createIsPrune };
|
|
716
|
-
|
|
717
|
-
/**
|
|
718
|
-
* Creates a reusable {@link validatePrune} function.
|
|
719
|
-
*
|
|
720
|
-
* @danger You must configure the generic argument `T`
|
|
721
|
-
* @returns Nothing until you configure the generic argument `T`
|
|
722
|
-
* @throws compile error
|
|
723
|
-
*
|
|
724
|
-
* @author Jeongho Nam - https://github.com/samchon
|
|
725
|
-
*/
|
|
726
|
-
function createValidatePrune(): never;
|
|
727
|
-
|
|
728
|
-
/**
|
|
729
|
-
* Creates a resuable {@link validatePrune} function.
|
|
730
|
-
*
|
|
731
|
-
* @template T Type of the input value
|
|
732
|
-
* @returns A reusable `validatePrune` function
|
|
733
|
-
*
|
|
734
|
-
* @author Jeongho Nam - https://github.com/samchon
|
|
735
|
-
*/
|
|
736
|
-
function createValidatePrune<T extends object>(): (input: T) => IValidation<T>;
|
|
737
|
-
|
|
738
|
-
/**
|
|
739
|
-
* @internal
|
|
740
|
-
*/
|
|
741
|
-
function createValidatePrune<T extends object>(): (input: T) => IValidation<T> {
|
|
742
|
-
halt("createValidatePrune");
|
|
743
|
-
}
|
|
744
|
-
const createValidatePrunePure = /** @__PURE__ */ Object.assign<
|
|
745
|
-
typeof createValidatePrune,
|
|
746
|
-
{}
|
|
747
|
-
>(createValidatePrune, validatePrunePure);
|
|
748
|
-
export { createValidatePrunePure as createValidatePrune };
|
|
749
|
-
|
|
750
|
-
/**
|
|
751
|
-
* @internal
|
|
752
|
-
*/
|
|
753
|
-
function halt(name: string): never {
|
|
754
|
-
throw new Error(
|
|
755
|
-
`Error on typia.misc.${name}(): no transform has been configured. Read and follow https://typia.io/docs/setup please.`,
|
|
756
|
-
);
|
|
757
|
-
}
|
|
1
|
+
/* ===========================================================
|
|
2
|
+
MISCELLAENOUS
|
|
3
|
+
- LITERALS
|
|
4
|
+
- CLONE
|
|
5
|
+
- PRUNE
|
|
6
|
+
- FACTORY FUNCTIONS
|
|
7
|
+
==============================================================
|
|
8
|
+
LITERALS
|
|
9
|
+
----------------------------------------------------------- */
|
|
10
|
+
import * as Namespace from "./functional/Namespace";
|
|
11
|
+
|
|
12
|
+
import { Atomic } from "./typings/Atomic";
|
|
13
|
+
|
|
14
|
+
import { IValidation } from "./IValidation";
|
|
15
|
+
import { Resolved } from "./Resolved";
|
|
16
|
+
import { TypeGuardError } from "./TypeGuardError";
|
|
17
|
+
|
|
18
|
+
/**
|
|
19
|
+
* > You must configure the generic argument `T`.
|
|
20
|
+
*
|
|
21
|
+
* Union literal type to array.
|
|
22
|
+
*
|
|
23
|
+
* Converts a union literal type to an array of its members.
|
|
24
|
+
*
|
|
25
|
+
* ```typescript
|
|
26
|
+
* literals<"A" | "B" | 1>; // ["A", "B", 1]
|
|
27
|
+
* ```
|
|
28
|
+
*
|
|
29
|
+
* @template T Union literal type
|
|
30
|
+
* @return Array of union literal type's members
|
|
31
|
+
*
|
|
32
|
+
* @author Jeongho Nam - https://github.com/samchon
|
|
33
|
+
*/
|
|
34
|
+
export function literals(): never;
|
|
35
|
+
|
|
36
|
+
/**
|
|
37
|
+
* Union literal type to array.
|
|
38
|
+
*
|
|
39
|
+
* Converts a union literal type to an array of its members.
|
|
40
|
+
*
|
|
41
|
+
* ```typescript
|
|
42
|
+
* literals<"A" | "B" | 1>; // ["A", "B", 1]
|
|
43
|
+
* ```
|
|
44
|
+
*
|
|
45
|
+
* @template T Union literal type
|
|
46
|
+
* @return Array of union literal type's members
|
|
47
|
+
*
|
|
48
|
+
* @author Jeongho Nam - https://github.com/samchon
|
|
49
|
+
*/
|
|
50
|
+
export function literals<T extends Atomic.Type | null>(): T[];
|
|
51
|
+
|
|
52
|
+
/**
|
|
53
|
+
* @internal
|
|
54
|
+
*/
|
|
55
|
+
export function literals(): never {
|
|
56
|
+
halt("literals");
|
|
57
|
+
}
|
|
58
|
+
|
|
59
|
+
/* -----------------------------------------------------------
|
|
60
|
+
CLONE
|
|
61
|
+
----------------------------------------------------------- */
|
|
62
|
+
/**
|
|
63
|
+
* Clone a data.
|
|
64
|
+
*
|
|
65
|
+
* Clones an instance following type `T`. If the target *input* value or its member
|
|
66
|
+
* variable contains a class instance having methods, those methods would not be
|
|
67
|
+
* cloned.
|
|
68
|
+
*
|
|
69
|
+
* For reference, this `typia.misc.clone()` function does not validate the input value
|
|
70
|
+
* type. It just believes that the input value is following the type `T`. Therefore,
|
|
71
|
+
* if you can't ensure the input value type, it would be better to call
|
|
72
|
+
* {@link assertClone} function instead.
|
|
73
|
+
*
|
|
74
|
+
* @template T Type of the input value
|
|
75
|
+
* @param input A value to be cloned
|
|
76
|
+
* @return Cloned data
|
|
77
|
+
*
|
|
78
|
+
* @author Jeongho Nam - https://github.com/samchon
|
|
79
|
+
*/
|
|
80
|
+
function clone<T>(input: T): Resolved<T>;
|
|
81
|
+
|
|
82
|
+
/**
|
|
83
|
+
* @internal
|
|
84
|
+
*/
|
|
85
|
+
function clone(): never {
|
|
86
|
+
halt("clone");
|
|
87
|
+
}
|
|
88
|
+
const clonePure = /** @__PURE__ */ Object.assign<typeof clone, {}>(
|
|
89
|
+
clone,
|
|
90
|
+
/** @__PURE__ */ Namespace.misc.clone("clone"),
|
|
91
|
+
);
|
|
92
|
+
export { clonePure as clone };
|
|
93
|
+
|
|
94
|
+
/**
|
|
95
|
+
* Clone a data with type assertion.
|
|
96
|
+
*
|
|
97
|
+
* Clones an instance following type `T`, with type assertion. If the target `input`
|
|
98
|
+
* value or its member variable contains a class instance having methods, those
|
|
99
|
+
* methods would not be cloned.
|
|
100
|
+
*
|
|
101
|
+
* In such reason, when `input` value is not matched with the type `T`, it throws an
|
|
102
|
+
* {@link TypeGuardError} or custom error generated by *errorFactory*. Otherwise,
|
|
103
|
+
* there's no problem on the `input` value, cloned data would be returned.
|
|
104
|
+
*
|
|
105
|
+
* @template T Type of the input value
|
|
106
|
+
* @param input A value to be cloned
|
|
107
|
+
* @param errorFactory Custom error factory. Default is `TypeGuardError`
|
|
108
|
+
* @return Cloned data
|
|
109
|
+
*
|
|
110
|
+
* @author Jeongho Nam - https://github.com/samchon
|
|
111
|
+
*/
|
|
112
|
+
function assertClone<T>(
|
|
113
|
+
input: T,
|
|
114
|
+
errorFactory?: undefined | ((props: TypeGuardError.IProps) => Error),
|
|
115
|
+
): Resolved<T>;
|
|
116
|
+
|
|
117
|
+
/**
|
|
118
|
+
* Clone a data with type assertion.
|
|
119
|
+
*
|
|
120
|
+
* Clones an instance following type `T`, with type assertion. If the target `input`
|
|
121
|
+
* value or its member variable contains a class instance having methods, those
|
|
122
|
+
* methods would not be cloned.
|
|
123
|
+
*
|
|
124
|
+
* In such reason, when `input` value is not matched with the type `T`, it throws an
|
|
125
|
+
* {@link TypeGuardError} or custom error generated by *errorFactory*. Otherwise,
|
|
126
|
+
* there's no problem on the `input` value, cloned data would be returned.
|
|
127
|
+
*
|
|
128
|
+
* @template T Type of the input value
|
|
129
|
+
* @param input A value to be cloned
|
|
130
|
+
* @param errorFactory Custom error factory. Default is `TypeGuardError`
|
|
131
|
+
* @return Cloned data
|
|
132
|
+
*
|
|
133
|
+
* @author Jeongho Nam - https://github.com/samchon
|
|
134
|
+
*/
|
|
135
|
+
function assertClone<T>(
|
|
136
|
+
input: unknown,
|
|
137
|
+
errorFactory?: undefined | ((props: TypeGuardError.IProps) => Error),
|
|
138
|
+
): Resolved<T>;
|
|
139
|
+
|
|
140
|
+
/**
|
|
141
|
+
* @internal
|
|
142
|
+
*/
|
|
143
|
+
function assertClone(): never {
|
|
144
|
+
halt("assertClone");
|
|
145
|
+
}
|
|
146
|
+
const assertClonePure = /** @__PURE__ */ Object.assign<
|
|
147
|
+
typeof assertClone,
|
|
148
|
+
{},
|
|
149
|
+
{}
|
|
150
|
+
>(
|
|
151
|
+
assertClone,
|
|
152
|
+
/** @__PURE__ */ Namespace.assert("misc.assertClone"),
|
|
153
|
+
/** @__PURE__ */ Namespace.misc.clone("assertClone"),
|
|
154
|
+
);
|
|
155
|
+
export { assertClonePure as assertClone };
|
|
156
|
+
|
|
157
|
+
/**
|
|
158
|
+
* Clone a data with type checking.
|
|
159
|
+
*
|
|
160
|
+
* Clones an instance following type `T`, with type checking. If the target `input`
|
|
161
|
+
* value or its member variable contains a class instance having methods, those
|
|
162
|
+
* methods would not be cloned.
|
|
163
|
+
*
|
|
164
|
+
* In such reason, when `input` value is not matched with the type `T`, it returns
|
|
165
|
+
* `null` value instead. Otherwise, there's no problem on the `input` value, cloned
|
|
166
|
+
* data would be returned.
|
|
167
|
+
*
|
|
168
|
+
* @template T Type of the input value
|
|
169
|
+
* @param input A value to be cloned
|
|
170
|
+
* @return Cloned data when exact type, otherwise null
|
|
171
|
+
*
|
|
172
|
+
* @author Jeongho Nam - https://github.com/samchon
|
|
173
|
+
*/
|
|
174
|
+
function isClone<T>(input: T): Resolved<T> | null;
|
|
175
|
+
|
|
176
|
+
/**
|
|
177
|
+
* Clone a data with type checking.
|
|
178
|
+
*
|
|
179
|
+
* Clones an instance following type `T`, with type checking. If the target `input`
|
|
180
|
+
* value or its member variable contains a class instance having methods, those
|
|
181
|
+
* methods would not be cloned.
|
|
182
|
+
*
|
|
183
|
+
* In such reason, when `input` value is not matched with the type `T`, it returns
|
|
184
|
+
* `null` value instead. Otherwise, there's no problem on the `input` value, cloned
|
|
185
|
+
* data would be returned.
|
|
186
|
+
*
|
|
187
|
+
* @template T Type of the input value
|
|
188
|
+
* @param input A value to be cloned
|
|
189
|
+
* @return Cloned data when exact type, otherwise null
|
|
190
|
+
*
|
|
191
|
+
* @author Jeongho Nam - https://github.com/samchon
|
|
192
|
+
*/
|
|
193
|
+
function isClone<T>(input: unknown): Resolved<T> | null;
|
|
194
|
+
|
|
195
|
+
/**
|
|
196
|
+
* @internal
|
|
197
|
+
*/
|
|
198
|
+
function isClone(): never {
|
|
199
|
+
halt("isClone");
|
|
200
|
+
}
|
|
201
|
+
const isClonePure = /** @__PURE__ */ Object.assign<typeof isClone, {}, {}>(
|
|
202
|
+
isClone,
|
|
203
|
+
/** @__PURE__ */ Namespace.is(),
|
|
204
|
+
/** @__PURE__ */ Namespace.misc.clone("isClone"),
|
|
205
|
+
);
|
|
206
|
+
export { isClonePure as isClone };
|
|
207
|
+
|
|
208
|
+
/**
|
|
209
|
+
* Clone a data with detailed type validation.
|
|
210
|
+
*
|
|
211
|
+
* Clones an instance following type `T`, with detailed type validation. If the target
|
|
212
|
+
* `input` value or its member variable contains a class instance having methods,
|
|
213
|
+
* those methods would not be cloned.
|
|
214
|
+
*
|
|
215
|
+
* In such reason, when `input` value is not matched with the type `T`, it returns
|
|
216
|
+
* {@link IValidation.Failure} value. Otherwise, there's no problem on the `input`
|
|
217
|
+
* value, cloned data would be stored in `data` property of the output
|
|
218
|
+
* {@link IValidation.Success} instance.
|
|
219
|
+
*
|
|
220
|
+
* @template T Type of the input value
|
|
221
|
+
* @param input A value to be cloned
|
|
222
|
+
* @returns Validation result with cloned value
|
|
223
|
+
*/
|
|
224
|
+
function validateClone<T>(input: T): IValidation<Resolved<T>>;
|
|
225
|
+
|
|
226
|
+
/**
|
|
227
|
+
* Clone a data with detailed type validation.
|
|
228
|
+
*
|
|
229
|
+
* Clones an instance following type `T`, with detailed type validation. If the target
|
|
230
|
+
* `input` value or its member variable contains a class instance having methods,
|
|
231
|
+
* those methods would not be cloned.
|
|
232
|
+
*
|
|
233
|
+
* In such reason, when `input` value is not matched with the type `T`, it returns
|
|
234
|
+
* {@link IValidation.Failure} value. Otherwise, there's no problem on the `input`
|
|
235
|
+
* value, cloned data would be stored in `data` property of the output
|
|
236
|
+
* {@link IValidation.Success} instance.
|
|
237
|
+
*
|
|
238
|
+
* @template T Type of the input value
|
|
239
|
+
* @param input A value to be cloned
|
|
240
|
+
* @returns Validation result with cloned value
|
|
241
|
+
*/
|
|
242
|
+
function validateClone<T>(input: unknown): IValidation<Resolved<T>>;
|
|
243
|
+
|
|
244
|
+
/**
|
|
245
|
+
* @internal
|
|
246
|
+
*/
|
|
247
|
+
function validateClone(): never {
|
|
248
|
+
halt("validateClone");
|
|
249
|
+
}
|
|
250
|
+
const validateClonePure = /** @__PURE__ */ Object.assign<
|
|
251
|
+
typeof validateClone,
|
|
252
|
+
{},
|
|
253
|
+
{}
|
|
254
|
+
>(
|
|
255
|
+
validateClone,
|
|
256
|
+
/** @__PURE__ */ Namespace.validate(),
|
|
257
|
+
/** @__PURE__ */ Namespace.misc.clone("validateClone"),
|
|
258
|
+
);
|
|
259
|
+
export { validateClonePure as validateClone };
|
|
260
|
+
|
|
261
|
+
/* -----------------------------------------------------------
|
|
262
|
+
PRUNE
|
|
263
|
+
----------------------------------------------------------- */
|
|
264
|
+
/**
|
|
265
|
+
* Prune, erase superfluous properties.
|
|
266
|
+
*
|
|
267
|
+
* Remove every superfluous properties from the `input` object, even including nested
|
|
268
|
+
* objects. Note that, as every superfluous properties would be deleted, you never can
|
|
269
|
+
* read those superfluous properties after calling this `prune()` function.
|
|
270
|
+
*
|
|
271
|
+
* For reference, this `typia.misc.prune()` function does not validate the input value
|
|
272
|
+
* type. It just believes that the input value is following the type `T`. Therefore,
|
|
273
|
+
* if you can't ensure the input value type, it would better to call one of below
|
|
274
|
+
* functions instead.
|
|
275
|
+
*
|
|
276
|
+
* - {@link assertPrune}
|
|
277
|
+
* - {@link isPrune}
|
|
278
|
+
* - {@link validatePrune}
|
|
279
|
+
*
|
|
280
|
+
* @template T Type of the input value
|
|
281
|
+
* @param input Target instance to prune
|
|
282
|
+
*
|
|
283
|
+
* @author Jeongho Nam - https://github.com/samchon
|
|
284
|
+
*/
|
|
285
|
+
function prune<T extends object>(input: T): void;
|
|
286
|
+
|
|
287
|
+
/**
|
|
288
|
+
* @internal
|
|
289
|
+
*/
|
|
290
|
+
function prune(): never {
|
|
291
|
+
halt("prune");
|
|
292
|
+
}
|
|
293
|
+
const prunePure = /** @__PURE__ */ Object.assign<typeof prune, {}>(
|
|
294
|
+
prune,
|
|
295
|
+
/** @__PURE__ */ Namespace.misc.prune("prune"),
|
|
296
|
+
);
|
|
297
|
+
export { prunePure as prune };
|
|
298
|
+
|
|
299
|
+
/**
|
|
300
|
+
* Prune, erase superfluous properties, with type assertion.
|
|
301
|
+
*
|
|
302
|
+
* `typia.misc.assertPrune()` is a combination function of {@link assert} and
|
|
303
|
+
* {@link prune}. Therefore, it removes every superfluous properties from the `input`
|
|
304
|
+
* object including nested objects, with type assertion.
|
|
305
|
+
*
|
|
306
|
+
* In such reason, when `input` value is not matched with the type `T`, it throws an
|
|
307
|
+
* {@link TypeGuardError} or custom error generated by *errorFactory*. Otherwise,
|
|
308
|
+
* there's no problem on the `input` value, its every superfluous properties would be
|
|
309
|
+
* removed, including nested objects.
|
|
310
|
+
*
|
|
311
|
+
* @template T Type of the input value
|
|
312
|
+
* @param input Target instance to assert and prune
|
|
313
|
+
* @param errorFactory Custom error factory. Default is `TypeGuardError`
|
|
314
|
+
*
|
|
315
|
+
* @author Jeongho Nam - https://github.com/samchon
|
|
316
|
+
*/
|
|
317
|
+
function assertPrune<T>(
|
|
318
|
+
input: T,
|
|
319
|
+
errorFactory?: undefined | ((props: TypeGuardError.IProps) => Error),
|
|
320
|
+
): T;
|
|
321
|
+
|
|
322
|
+
/**
|
|
323
|
+
* Prune, erase superfluous properties, with type assertion.
|
|
324
|
+
*
|
|
325
|
+
* `typia.misc.assertPrune()` is a combination function of {@link assert} and
|
|
326
|
+
* {@link prune}. Therefore, it removes every superfluous properties from the `input`
|
|
327
|
+
* object including nested objects, with type assertion.
|
|
328
|
+
*
|
|
329
|
+
* In such reason, when `input` value is not matched with the type `T`, it throws an
|
|
330
|
+
* {@link TypeGuardError} or custom error generated by *errorFactory*. Otherwise, there's
|
|
331
|
+
* no problem on the `input` value, its every superfluous properties would be removed,
|
|
332
|
+
* including nested objects.
|
|
333
|
+
*
|
|
334
|
+
* @template T Type of the input value
|
|
335
|
+
* @param input Target instance to assert and prune
|
|
336
|
+
* @param errorFactory Custom error factory. Default is `TypeGuardError`
|
|
337
|
+
*
|
|
338
|
+
* @author Jeongho Nam - https://github.com/samchon
|
|
339
|
+
*/
|
|
340
|
+
function assertPrune<T>(
|
|
341
|
+
input: unknown,
|
|
342
|
+
errorFactory?: undefined | ((props: TypeGuardError.IProps) => Error),
|
|
343
|
+
): T;
|
|
344
|
+
|
|
345
|
+
/**
|
|
346
|
+
* @internal
|
|
347
|
+
*/
|
|
348
|
+
function assertPrune(): unknown {
|
|
349
|
+
halt("assertPrune");
|
|
350
|
+
}
|
|
351
|
+
const assertPrunePure = /** @__PURE__ */ Object.assign<
|
|
352
|
+
typeof assertPrune,
|
|
353
|
+
{},
|
|
354
|
+
{}
|
|
355
|
+
>(
|
|
356
|
+
assertPrune,
|
|
357
|
+
/** @__PURE__ */ Namespace.assert("misc.assertPrune"),
|
|
358
|
+
/** @__PURE__ */ Namespace.misc.prune("assertPrune"),
|
|
359
|
+
);
|
|
360
|
+
export { assertPrunePure as assertPrune };
|
|
361
|
+
|
|
362
|
+
/**
|
|
363
|
+
* Prune, erase superfluous properties, with type checking.
|
|
364
|
+
*
|
|
365
|
+
* `typia.misc.assertPrune()` is a combination function of {@link is} and
|
|
366
|
+
* {@link prune}. Therefore, it removes every superfluous properties from the `input`
|
|
367
|
+
* object including nested objects, with type checking.
|
|
368
|
+
*
|
|
369
|
+
* In such reason, when `input` value is not matched with the type `T`, it returns
|
|
370
|
+
* `false` value. Otherwise, there's no problem on the `input` value, it returns
|
|
371
|
+
* `true` after removing every superfluous properties, including nested objects.
|
|
372
|
+
*
|
|
373
|
+
* @template T Type of the input value
|
|
374
|
+
* @param input Target instance to check and prune
|
|
375
|
+
* @returns Whether the parametric value is following the type `T` or not
|
|
376
|
+
*
|
|
377
|
+
* @author Jeongho Nam - https://github.com/samchon
|
|
378
|
+
*/
|
|
379
|
+
function isPrune<T>(input: T): input is T;
|
|
380
|
+
|
|
381
|
+
/**
|
|
382
|
+
* Prune, erase superfluous properties, with type checking.
|
|
383
|
+
*
|
|
384
|
+
* `typia.misc.assertPrune()` is a combination function of {@link is} and
|
|
385
|
+
* {@link prune}. Therefore, it removes every superfluous properties from the `input`
|
|
386
|
+
* object including nested objects, with type checking.
|
|
387
|
+
*
|
|
388
|
+
* In such reason, when `input` value is not matched with the type `T`, it returns
|
|
389
|
+
* `false` value. Otherwise, there's no problem on the `input` value, it returns
|
|
390
|
+
* `true` after removing every superfluous properties, including nested objects.
|
|
391
|
+
*
|
|
392
|
+
* @template T Type of the input value
|
|
393
|
+
* @param input Target instance to check and prune
|
|
394
|
+
* @returns Whether the parametric value is following the type `T` or not
|
|
395
|
+
*
|
|
396
|
+
* @author Jeongho Nam - https://github.com/samchon
|
|
397
|
+
*/
|
|
398
|
+
function isPrune<T>(input: unknown): input is T;
|
|
399
|
+
|
|
400
|
+
/**
|
|
401
|
+
* @internal
|
|
402
|
+
*/
|
|
403
|
+
function isPrune(): never {
|
|
404
|
+
halt("isPrune");
|
|
405
|
+
}
|
|
406
|
+
const isPrunePure = /** @__PURE__ */ Object.assign<typeof isPrune, {}, {}>(
|
|
407
|
+
isPrune,
|
|
408
|
+
/** @__PURE__ */ Namespace.is(),
|
|
409
|
+
/** @__PURE__ */ Namespace.misc.prune("isPrune"),
|
|
410
|
+
);
|
|
411
|
+
export { isPrunePure as isPrune };
|
|
412
|
+
|
|
413
|
+
/**
|
|
414
|
+
* Prune, erase superfluous properties, with type validation.
|
|
415
|
+
*
|
|
416
|
+
* `typia.misc.validatePrune()` is a combination function of {@link validate} and
|
|
417
|
+
* {@link prune}. Therefore, it removes every superfluous properties from the `input`
|
|
418
|
+
* object including nested objects, with type validation.
|
|
419
|
+
*
|
|
420
|
+
* In such reason, when `input` value is not matched with the type `T`, it returns
|
|
421
|
+
* {@link IValidation.IFailure} value with detailed error reasons. Otherwise, there's
|
|
422
|
+
* no problem on the `input` value, it returns {@link IValidation.ISucess} value after
|
|
423
|
+
* removing every superfluous properties, including nested objects.
|
|
424
|
+
*
|
|
425
|
+
* @template T Type of the input value
|
|
426
|
+
* @param input Target instance to validate and prune
|
|
427
|
+
* @returns Validation result
|
|
428
|
+
*
|
|
429
|
+
* @author Jeongho Nam - https://github.com/samchon
|
|
430
|
+
*/
|
|
431
|
+
function validatePrune<T>(input: T): IValidation<T>;
|
|
432
|
+
|
|
433
|
+
/**
|
|
434
|
+
* Prune, erase superfluous properties, with type validation.
|
|
435
|
+
*
|
|
436
|
+
* `typia.misc.validatePrune()` is a combination function of {@link validate} and
|
|
437
|
+
* {@link prune}. Therefore, it removes every superfluous properties from the `input`
|
|
438
|
+
* object including nested objects, with type validation.
|
|
439
|
+
*
|
|
440
|
+
* In such reason, when `input` value is not matched with the type `T`, it returns
|
|
441
|
+
* {@link IValidation.IFailure} value with detailed error reasons. Otherwise, there's
|
|
442
|
+
* no problem on the `input` value, it returns {@link IValidation.ISucess} value after
|
|
443
|
+
* removing every superfluous properties, including nested objects.
|
|
444
|
+
*
|
|
445
|
+
* @template T Type of the input value
|
|
446
|
+
* @param input Target instance to validate and prune
|
|
447
|
+
* @returns Validation result
|
|
448
|
+
*
|
|
449
|
+
* @author Jeongho Nam - https://github.com/samchon
|
|
450
|
+
*/
|
|
451
|
+
function validatePrune<T>(input: unknown): IValidation<T>;
|
|
452
|
+
|
|
453
|
+
/**
|
|
454
|
+
* @internal
|
|
455
|
+
*/
|
|
456
|
+
function validatePrune<T>(): IValidation<T> {
|
|
457
|
+
halt("validatePrune");
|
|
458
|
+
}
|
|
459
|
+
|
|
460
|
+
const validatePrunePure = /** @__PURE__ */ Object.assign<
|
|
461
|
+
typeof validatePrune,
|
|
462
|
+
{},
|
|
463
|
+
{}
|
|
464
|
+
>(
|
|
465
|
+
validatePrune,
|
|
466
|
+
/** @__PURE__ */ Namespace.misc.prune("validatePrune"),
|
|
467
|
+
/** @__PURE__ */ Namespace.validate(),
|
|
468
|
+
);
|
|
469
|
+
export { validatePrunePure as validatePrune };
|
|
470
|
+
|
|
471
|
+
/* -----------------------------------------------------------
|
|
472
|
+
FACTORY FUNCTIONS
|
|
473
|
+
----------------------------------------------------------- */
|
|
474
|
+
/**
|
|
475
|
+
* Creates a reusable {@link clone} function.
|
|
476
|
+
*
|
|
477
|
+
* @danger You must configure the generic argument `T`
|
|
478
|
+
* @returns Nothing until you configure the generic argument `T`
|
|
479
|
+
* @throws compile error
|
|
480
|
+
*
|
|
481
|
+
* @author Jeongho Nam - https://github.com/samchon
|
|
482
|
+
*/
|
|
483
|
+
function createClone(): never;
|
|
484
|
+
|
|
485
|
+
/**
|
|
486
|
+
* Creates a resuable {@link clone} function.
|
|
487
|
+
*
|
|
488
|
+
* @template T Type of the input value
|
|
489
|
+
* @returns A reusable `clone` function
|
|
490
|
+
*
|
|
491
|
+
* @author Jeongho Nam - https://github.com/samchon
|
|
492
|
+
*/
|
|
493
|
+
function createClone<T>(): (input: T) => Resolved<T>;
|
|
494
|
+
|
|
495
|
+
/**
|
|
496
|
+
* @internal
|
|
497
|
+
*/
|
|
498
|
+
function createClone(): never {
|
|
499
|
+
halt("createClone");
|
|
500
|
+
}
|
|
501
|
+
const createClonePure = /** @__PURE__ */ Object.assign<typeof createClone, {}>(
|
|
502
|
+
createClone,
|
|
503
|
+
clonePure,
|
|
504
|
+
);
|
|
505
|
+
export { createClonePure as createClone };
|
|
506
|
+
|
|
507
|
+
/**
|
|
508
|
+
* Creates a reusable {@link assertClone} function.
|
|
509
|
+
*
|
|
510
|
+
* @danger You must configure the generic argument `T`
|
|
511
|
+
* @param errorFactory Custom error factory. Default is `TypeGuardError`
|
|
512
|
+
* @returns Nothing until you configure the generic argument `T`
|
|
513
|
+
* @throws compile error
|
|
514
|
+
*
|
|
515
|
+
* @author Jeongho Nam - https://github.com/samchon
|
|
516
|
+
*/
|
|
517
|
+
function createAssertClone(
|
|
518
|
+
errorFactory?: undefined | ((props: TypeGuardError.IProps) => Error),
|
|
519
|
+
): never;
|
|
520
|
+
|
|
521
|
+
/**
|
|
522
|
+
* Creates a resuable {@link assertClone} function.
|
|
523
|
+
*
|
|
524
|
+
* @template T Type of the input value
|
|
525
|
+
* @param errorFactory Custom error factory. Default is `TypeGuardError`
|
|
526
|
+
* @returns A reusable `clone` function
|
|
527
|
+
*
|
|
528
|
+
* @author Jeongho Nam - https://github.com/samchon
|
|
529
|
+
*/
|
|
530
|
+
function createAssertClone<T>(
|
|
531
|
+
errorFactory?: undefined | ((props: TypeGuardError.IProps) => Error),
|
|
532
|
+
): (input: unknown) => Resolved<T>;
|
|
533
|
+
|
|
534
|
+
/**
|
|
535
|
+
* @internal
|
|
536
|
+
*/
|
|
537
|
+
function createAssertClone(): never {
|
|
538
|
+
halt("createAssertClone");
|
|
539
|
+
}
|
|
540
|
+
const createAssertClonePure = /** @__PURE__ */ Object.assign<
|
|
541
|
+
typeof createAssertClone,
|
|
542
|
+
{}
|
|
543
|
+
>(createAssertClone, assertClonePure);
|
|
544
|
+
export { createAssertClonePure as createAssertClone };
|
|
545
|
+
|
|
546
|
+
/**
|
|
547
|
+
* Creates a reusable {@link isClone} function.
|
|
548
|
+
*
|
|
549
|
+
* @danger You must configure the generic argument `T`
|
|
550
|
+
* @returns Nothing until you configure the generic argument `T`
|
|
551
|
+
* @throws compile error
|
|
552
|
+
*
|
|
553
|
+
* @author Jeongho Nam - https://github.com/samchon
|
|
554
|
+
*/
|
|
555
|
+
function createIsClone(): never;
|
|
556
|
+
|
|
557
|
+
/**
|
|
558
|
+
* Creates a resuable {@link isClone} function.
|
|
559
|
+
*
|
|
560
|
+
* @template T Type of the input value
|
|
561
|
+
* @returns A reusable `clone` function
|
|
562
|
+
*
|
|
563
|
+
* @author Jeongho Nam - https://github.com/samchon
|
|
564
|
+
*/
|
|
565
|
+
function createIsClone<T>(): (input: unknown) => Resolved<T> | null;
|
|
566
|
+
|
|
567
|
+
/**
|
|
568
|
+
* @internal
|
|
569
|
+
*/
|
|
570
|
+
function createIsClone(): never {
|
|
571
|
+
halt("createIsClone");
|
|
572
|
+
}
|
|
573
|
+
const createIsClonePure = /** @__PURE__ */ Object.assign<
|
|
574
|
+
typeof createIsClone,
|
|
575
|
+
{}
|
|
576
|
+
>(createIsClone, isClonePure);
|
|
577
|
+
export { createIsClonePure as createIsClone };
|
|
578
|
+
|
|
579
|
+
/**
|
|
580
|
+
* Creates a reusable {@link validateClone} function.
|
|
581
|
+
*
|
|
582
|
+
* @danger You must configure the generic argument `T`
|
|
583
|
+
* @returns Nothing until you configure the generic argument `T`
|
|
584
|
+
* @throws compile error
|
|
585
|
+
*
|
|
586
|
+
* @author Jeongho Nam - https://github.com/samchon
|
|
587
|
+
*/
|
|
588
|
+
function createValidateClone(): never;
|
|
589
|
+
|
|
590
|
+
/**
|
|
591
|
+
* Creates a resuable {@link validateClone} function.
|
|
592
|
+
*
|
|
593
|
+
* @template T Type of the input value
|
|
594
|
+
* @returns A reusable `clone` function
|
|
595
|
+
*
|
|
596
|
+
* @author Jeongho Nam - https://github.com/samchon
|
|
597
|
+
*/
|
|
598
|
+
function createValidateClone<T>(): (input: unknown) => IValidation<Resolved<T>>;
|
|
599
|
+
|
|
600
|
+
/**
|
|
601
|
+
* @internal
|
|
602
|
+
*/
|
|
603
|
+
function createValidateClone(): never {
|
|
604
|
+
halt("createValidateClone");
|
|
605
|
+
}
|
|
606
|
+
const createValidateClonePure = /** @__PURE__ */ Object.assign<
|
|
607
|
+
typeof createValidateClone,
|
|
608
|
+
{}
|
|
609
|
+
>(createValidateClone, validateClonePure);
|
|
610
|
+
export { createValidateClonePure as createValidateClone };
|
|
611
|
+
|
|
612
|
+
/**
|
|
613
|
+
* Creates a reusable {@link prune} function.
|
|
614
|
+
*
|
|
615
|
+
* @danger You must configure the generic argument `T`
|
|
616
|
+
* @returns Nothing until you configure the generic argument `T`
|
|
617
|
+
* @throws compile error
|
|
618
|
+
*
|
|
619
|
+
* @author Jeongho Nam - https://github.com/samchon
|
|
620
|
+
*/
|
|
621
|
+
function createPrune(): never;
|
|
622
|
+
|
|
623
|
+
/**
|
|
624
|
+
* Creates a resuable {@link prune} function.
|
|
625
|
+
*
|
|
626
|
+
* @template T Type of the input value
|
|
627
|
+
* @returns A reusable `prune` function
|
|
628
|
+
*
|
|
629
|
+
* @author Jeongho Nam - https://github.com/samchon
|
|
630
|
+
*/
|
|
631
|
+
function createPrune<T extends object>(): (input: T) => void;
|
|
632
|
+
|
|
633
|
+
/**
|
|
634
|
+
* @internal
|
|
635
|
+
*/
|
|
636
|
+
function createPrune<T extends object>(): (input: T) => void {
|
|
637
|
+
halt("createPrune");
|
|
638
|
+
}
|
|
639
|
+
const createPrunePure = /** @__PURE__ */ Object.assign<typeof createPrune, {}>(
|
|
640
|
+
createPrune,
|
|
641
|
+
prunePure,
|
|
642
|
+
);
|
|
643
|
+
export { createPrunePure as createPrune };
|
|
644
|
+
|
|
645
|
+
/**
|
|
646
|
+
* Creates a reusable {@link assertPrune} function.
|
|
647
|
+
*
|
|
648
|
+
* @danger You must configure the generic argument `T`
|
|
649
|
+
* @param errorFactory Custom error factory. Default is `TypeGuardError`
|
|
650
|
+
* @returns Nothing until you configure the generic argument `T`
|
|
651
|
+
* @throws compile error
|
|
652
|
+
*
|
|
653
|
+
* @author Jeongho Nam - https://github.com/samchon
|
|
654
|
+
*/
|
|
655
|
+
function createAssertPrune(
|
|
656
|
+
errorFactory?: undefined | ((props: TypeGuardError.IProps) => Error),
|
|
657
|
+
): never;
|
|
658
|
+
|
|
659
|
+
/**
|
|
660
|
+
* Creates a resuable {@link assertPrune} function.
|
|
661
|
+
*
|
|
662
|
+
* @template T Type of the input value
|
|
663
|
+
* @param errorFactory Custom error factory. Default is `TypeGuardError`
|
|
664
|
+
* @returns A reusable `isPrune` function
|
|
665
|
+
*
|
|
666
|
+
* @author Jeongho Nam - https://github.com/samchon
|
|
667
|
+
*/
|
|
668
|
+
function createAssertPrune<T extends object>(
|
|
669
|
+
errorFactory?: undefined | ((props: TypeGuardError.IProps) => Error),
|
|
670
|
+
): (input: T) => T;
|
|
671
|
+
|
|
672
|
+
/**
|
|
673
|
+
* @internal
|
|
674
|
+
*/
|
|
675
|
+
function createAssertPrune<T extends object>(): (input: T) => T {
|
|
676
|
+
halt("createAssertPrune");
|
|
677
|
+
}
|
|
678
|
+
const createAssertPrunePure = /** @__PURE__ */ Object.assign<
|
|
679
|
+
typeof createAssertPrune,
|
|
680
|
+
{}
|
|
681
|
+
>(createAssertPrune, assertPrunePure);
|
|
682
|
+
export { createAssertPrunePure as createAssertPrune };
|
|
683
|
+
|
|
684
|
+
/**
|
|
685
|
+
* Creates a reusable {@link isPrune} function.
|
|
686
|
+
*
|
|
687
|
+
* @danger You must configure the generic argument `T`
|
|
688
|
+
* @returns Nothing until you configure the generic argument `T`
|
|
689
|
+
* @throws compile error
|
|
690
|
+
*
|
|
691
|
+
* @author Jeongho Nam - https://github.com/samchon
|
|
692
|
+
*/
|
|
693
|
+
function createIsPrune(): never;
|
|
694
|
+
|
|
695
|
+
/**
|
|
696
|
+
* Creates a resuable {@link isPrune} function.
|
|
697
|
+
*
|
|
698
|
+
* @template T Type of the input value
|
|
699
|
+
* @returns A reusable `isPrune` function
|
|
700
|
+
*
|
|
701
|
+
* @author Jeongho Nam - https://github.com/samchon
|
|
702
|
+
*/
|
|
703
|
+
function createIsPrune<T extends object>(): (input: T) => input is T;
|
|
704
|
+
|
|
705
|
+
/**
|
|
706
|
+
* @internal
|
|
707
|
+
*/
|
|
708
|
+
function createIsPrune<T extends object>(): (input: T) => input is T {
|
|
709
|
+
halt("createIsPrune");
|
|
710
|
+
}
|
|
711
|
+
const createIsPrunePure = /** @__PURE__ */ Object.assign<
|
|
712
|
+
typeof createIsPrune,
|
|
713
|
+
{}
|
|
714
|
+
>(createIsPrune, isPrunePure);
|
|
715
|
+
export { createIsPrunePure as createIsPrune };
|
|
716
|
+
|
|
717
|
+
/**
|
|
718
|
+
* Creates a reusable {@link validatePrune} function.
|
|
719
|
+
*
|
|
720
|
+
* @danger You must configure the generic argument `T`
|
|
721
|
+
* @returns Nothing until you configure the generic argument `T`
|
|
722
|
+
* @throws compile error
|
|
723
|
+
*
|
|
724
|
+
* @author Jeongho Nam - https://github.com/samchon
|
|
725
|
+
*/
|
|
726
|
+
function createValidatePrune(): never;
|
|
727
|
+
|
|
728
|
+
/**
|
|
729
|
+
* Creates a resuable {@link validatePrune} function.
|
|
730
|
+
*
|
|
731
|
+
* @template T Type of the input value
|
|
732
|
+
* @returns A reusable `validatePrune` function
|
|
733
|
+
*
|
|
734
|
+
* @author Jeongho Nam - https://github.com/samchon
|
|
735
|
+
*/
|
|
736
|
+
function createValidatePrune<T extends object>(): (input: T) => IValidation<T>;
|
|
737
|
+
|
|
738
|
+
/**
|
|
739
|
+
* @internal
|
|
740
|
+
*/
|
|
741
|
+
function createValidatePrune<T extends object>(): (input: T) => IValidation<T> {
|
|
742
|
+
halt("createValidatePrune");
|
|
743
|
+
}
|
|
744
|
+
const createValidatePrunePure = /** @__PURE__ */ Object.assign<
|
|
745
|
+
typeof createValidatePrune,
|
|
746
|
+
{}
|
|
747
|
+
>(createValidatePrune, validatePrunePure);
|
|
748
|
+
export { createValidatePrunePure as createValidatePrune };
|
|
749
|
+
|
|
750
|
+
/**
|
|
751
|
+
* @internal
|
|
752
|
+
*/
|
|
753
|
+
function halt(name: string): never {
|
|
754
|
+
throw new Error(
|
|
755
|
+
`Error on typia.misc.${name}(): no transform has been configured. Read and follow https://typia.io/docs/setup please.`,
|
|
756
|
+
);
|
|
757
|
+
}
|