diff --git a/package.json b/package.json index 2588d86dd1..6c62293860 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "typia", - "version": "5.2.4", + "version": "5.2.5", "description": "Superfast runtime validators with only one line", "main": "lib/index.js", "typings": "lib/index.d.ts", @@ -134,7 +134,7 @@ "zod": "^3.19.1" }, "stackblitzs": { - "startCommand": "npm run prepare && npm run build && npm run build:test && npm run test" + "startCommand": "npm run prepare && npm run build:test:actions && npm run build:test && npm run test" }, "files": [ "LICENSE", diff --git a/packages/typescript-json/package.json b/packages/typescript-json/package.json index 020d9a1493..adcb2c7df4 100644 --- a/packages/typescript-json/package.json +++ b/packages/typescript-json/package.json @@ -1,6 +1,6 @@ { "name": "typescript-json", - "version": "5.2.4", + "version": "5.2.5", "description": "Superfast runtime validators with only one line", "main": "lib/index.js", "typings": "lib/index.d.ts", @@ -72,13 +72,13 @@ }, "homepage": "https://typia.io", "dependencies": { - "typia": "5.2.4" + "typia": "5.2.5" }, "peerDependencies": { "typescript": ">=4.8.0 <5.3.0" }, "stackblitzs": { - "startCommand": "npm run prepare && npm run build && npm run build:test && npm run test" + "startCommand": "npm run prepare && npm run build:test:actions && npm run build:test && npm run test" }, "files": [ "LICENSE", diff --git a/src/factories/internal/metadata/emplace_metadata_object.ts b/src/factories/internal/metadata/emplace_metadata_object.ts index a96c6d3c84..57f6f7b8d1 100644 --- a/src/factories/internal/metadata/emplace_metadata_object.ts +++ b/src/factories/internal/metadata/emplace_metadata_object.ts @@ -126,6 +126,34 @@ export const emplace_metadata_object = const key: Metadata = analyzer(index.keyType)(null); const value: Metadata = analyzer(index.type)({}); + if ( + key.atomics.length + + key.constants + .map((c) => c.values.length) + .reduce((a, b) => a + b, 0) + + key.templates.length + + key.natives.filter( + (type) => + type === "Boolean" || + type === "BigInt" || + type === "Number" || + type === "String", + ).length !== + key.size() + ) + errors.push({ + name: key.getName(), + explore: { + top: false, + object: obj, + property: "[key]", + nested: null, + escaped: false, + aliased: false, + }, + messages: [], + }); + // INSERT WITH REQUIRED CONFIGURATION insert(key)(value)( index.declaration?.parent diff --git a/src/functional/$stoll.ts b/src/functional/$stoll.ts new file mode 100644 index 0000000000..1f83ea5bd3 --- /dev/null +++ b/src/functional/$stoll.ts @@ -0,0 +1,8 @@ +export const $is_bigint_string = (str: string): boolean => { + try { + BigInt(str); + return true; + } catch { + return false; + } +}; diff --git a/src/functional/Namespace.ts b/src/functional/Namespace.ts index 1a0077f418..5a08c9a135 100644 --- a/src/functional/Namespace.ts +++ b/src/functional/Namespace.ts @@ -18,6 +18,7 @@ import { $join } from "./$join"; import { $number } from "./$number"; import { $report } from "./$report"; import { $rest } from "./$rest"; +import { $is_bigint_string } from "./$stoll"; import { $string } from "./$string"; import { $strlen } from "./$strlen"; import { $tail } from "./$tail"; @@ -28,6 +29,7 @@ import { $tail } from "./$tail"; export namespace Namespace { export const is = () => ({ is_between: $is_between, + is_bigint_string: $is_bigint_string, }); export const assert = (method: string) => ({ @@ -97,11 +99,13 @@ export namespace Namespace { export namespace protobuf { export const decode = (method: string) => ({ + ...is(), Reader: $ProtobufReader, throws: $throws(`protobuf.${method}`), }); export const encode = (method: string) => ({ + ...is(), Sizer: $ProtobufSizer, Writer: $ProtobufWriter, strlen: $strlen, diff --git a/src/programmers/AssertProgrammer.ts b/src/programmers/AssertProgrammer.ts index 42937dcf70..5b54c2c2ad 100644 --- a/src/programmers/AssertProgrammer.ts +++ b/src/programmers/AssertProgrammer.ts @@ -91,8 +91,8 @@ export namespace AssertProgrammer { ), ]), ].reduce((x, y) => ts.factory.createLogicalAnd(x, y)), - combiner: combiner(equals)(importer), - joiner: joiner(equals)(importer), + combiner: combiner(equals)(project)(importer), + joiner: joiner(equals)(project)(importer), success: ts.factory.createTrue(), addition: () => importer.declare(modulo), })(importer)(type, name); @@ -148,13 +148,14 @@ export namespace AssertProgrammer { const combiner = (equals: boolean) => + (project: IProject) => (importer: FunctionImporter): CheckerProgrammer.IConfig.Combiner => (explore: CheckerProgrammer.IExplore) => { if (explore.tracable === false) return IsProgrammer.configure({ - object: assert_object(equals)(importer), + object: assert_object(equals)(project)(importer), numeric: true, - })(importer).combiner(explore); + })(project)(importer).combiner(explore); const path: string = explore.postfix ? `_path + ${explore.postfix}` @@ -219,40 +220,44 @@ export namespace AssertProgrammer { // })(); }; - const assert_object = (equals: boolean) => (importer: FunctionImporter) => - check_object({ - equals, - assert: true, - undefined: true, - reduce: ts.factory.createLogicalAnd, - positive: ts.factory.createTrue(), - superfluous: (value) => - create_guard_call(importer)()( - ts.factory.createAdd( - ts.factory.createIdentifier("_path"), - ts.factory.createCallExpression( - importer.use("join"), - undefined, - [ts.factory.createIdentifier("key")], + const assert_object = + (equals: boolean) => + (project: IProject) => + (importer: FunctionImporter) => + check_object({ + equals, + assert: true, + undefined: true, + reduce: ts.factory.createLogicalAnd, + positive: ts.factory.createTrue(), + superfluous: (value) => + create_guard_call(importer)()( + ts.factory.createAdd( + ts.factory.createIdentifier("_path"), + ts.factory.createCallExpression( + importer.use("join"), + undefined, + [ts.factory.createIdentifier("key")], + ), ), + "undefined", + value, ), - "undefined", - value, - ), - halt: (expr) => - ts.factory.createLogicalOr( - ts.factory.createStrictEquality( - ts.factory.createFalse(), - ts.factory.createIdentifier("_exceptionable"), + halt: (expr) => + ts.factory.createLogicalOr( + ts.factory.createStrictEquality( + ts.factory.createFalse(), + ts.factory.createIdentifier("_exceptionable"), + ), + expr, ), - expr, - ), - })(importer); + })(project)(importer); const joiner = (equals: boolean) => + (project: IProject) => (importer: FunctionImporter): CheckerProgrammer.IConfig.IJoiner => ({ - object: assert_object(equals)(importer), + object: assert_object(equals)(project)(importer), array: (input, arrow) => ts.factory.createCallExpression( IdentifierFactory.access(input)("every"), diff --git a/src/programmers/IsProgrammer.ts b/src/programmers/IsProgrammer.ts index de16b22ec8..a9a0c3a636 100644 --- a/src/programmers/IsProgrammer.ts +++ b/src/programmers/IsProgrammer.ts @@ -21,6 +21,7 @@ import { feature_object_entries } from "./internal/feature_object_entries"; export namespace IsProgrammer { export const configure = (options?: Partial) => + (project: IProject) => (importer: FunctionImporter): CheckerProgrammer.IConfig => ({ prefix: "$i", equals: !!options?.object, @@ -79,7 +80,7 @@ export namespace IsProgrammer { reduce: ts.factory.createLogicalAnd, positive: ts.factory.createTrue(), superfluous: () => ts.factory.createFalse(), - })(importer), + })(project)(importer), array: (input, arrow) => ts.factory.createCallExpression( IdentifierFactory.access(input)("every"), @@ -126,9 +127,9 @@ export namespace IsProgrammer { reduce: ts.factory.createLogicalAnd, positive: ts.factory.createTrue(), superfluous: () => ts.factory.createFalse(), - })(importer), + })(project)(importer), numeric: OptionPredicator.numeric(project.options), - })(importer), + })(project)(importer), trace: equals, addition: () => importer.declare(modulo), }; @@ -185,7 +186,7 @@ export namespace IsProgrammer { (project: IProject) => (importer: FunctionImporter) => (collection: MetadataCollection) => { - const config = configure()(importer); + const config = configure()(project)(importer); const objects = CheckerProgrammer.write_object_functions(project)(config)( importer, @@ -223,10 +224,15 @@ export namespace IsProgrammer { DECODERS ----------------------------------------------------------- */ export const decode = (project: IProject) => (importer: FunctionImporter) => - CheckerProgrammer.decode(project)(configure()(importer))(importer); + CheckerProgrammer.decode(project)(configure()(project)(importer))( + importer, + ); - export const decode_object = (importer: FunctionImporter) => - CheckerProgrammer.decode_object(configure()(importer))(importer); + export const decode_object = + (project: IProject) => (importer: FunctionImporter) => + CheckerProgrammer.decode_object(configure()(project)(importer))( + importer, + ); export const decode_to_json = (checkNull: boolean) => diff --git a/src/programmers/ValidateProgrammer.ts b/src/programmers/ValidateProgrammer.ts index fe61b47d6c..6bc8303103 100644 --- a/src/programmers/ValidateProgrammer.ts +++ b/src/programmers/ValidateProgrammer.ts @@ -97,8 +97,8 @@ export namespace ValidateProgrammer { ), ]), ].reduce((x, y) => ts.factory.createLogicalAnd(x, y)), - combiner: combine(equals)(importer), - joiner: joiner(equals)(importer), + combiner: combine(equals)(project)(importer), + joiner: joiner(equals)(project)(importer), success: ts.factory.createTrue(), addition: () => importer.declare(modulo), }, @@ -195,13 +195,14 @@ export namespace ValidateProgrammer { const combine = (equals: boolean) => + (project: IProject) => (importer: FunctionImporter): CheckerProgrammer.IConfig.Combiner => (explore: CheckerProgrammer.IExplore) => { if (explore.tracable === false) return IsProgrammer.configure({ - object: validate_object(equals)(importer), + object: validate_object(equals)(project)(importer), numeric: true, - })(importer).combiner(explore); + })(project)(importer).combiner(explore); const path: string = explore.postfix ? `_path + ${explore.postfix}` @@ -240,40 +241,42 @@ const combine = ); }; -const validate_object = (equals: boolean) => (importer: FunctionImporter) => - check_object({ - equals, - undefined: true, - assert: false, - reduce: ts.factory.createLogicalAnd, - positive: ts.factory.createTrue(), - superfluous: (value) => - create_report_call()( - ts.factory.createAdd( - ts.factory.createIdentifier("_path"), - ts.factory.createCallExpression( - importer.use("join"), - undefined, - [ts.factory.createIdentifier("key")], +const validate_object = + (equals: boolean) => (project: IProject) => (importer: FunctionImporter) => + check_object({ + equals, + undefined: true, + assert: false, + reduce: ts.factory.createLogicalAnd, + positive: ts.factory.createTrue(), + superfluous: (value) => + create_report_call()( + ts.factory.createAdd( + ts.factory.createIdentifier("_path"), + ts.factory.createCallExpression( + importer.use("join"), + undefined, + [ts.factory.createIdentifier("key")], + ), ), + "undefined", + value, ), - "undefined", - value, - ), - halt: (expr) => - ts.factory.createLogicalOr( - ts.factory.createStrictEquality( - ts.factory.createFalse(), - ts.factory.createIdentifier("_exceptionable"), + halt: (expr) => + ts.factory.createLogicalOr( + ts.factory.createStrictEquality( + ts.factory.createFalse(), + ts.factory.createIdentifier("_exceptionable"), + ), + expr, ), - expr, - ), - })(importer); + })(project)(importer); const joiner = (equals: boolean) => + (project: IProject) => (importer: FunctionImporter): CheckerProgrammer.IConfig.IJoiner => ({ - object: validate_object(equals)(importer), + object: validate_object(equals)(project)(importer), array: (input, arrow) => check_everything( ts.factory.createCallExpression( diff --git a/src/programmers/internal/check_dynamic_key.ts b/src/programmers/internal/check_dynamic_key.ts new file mode 100644 index 0000000000..631dd8fef1 --- /dev/null +++ b/src/programmers/internal/check_dynamic_key.ts @@ -0,0 +1,178 @@ +import ts from "typescript"; + +import { Metadata } from "../../schemas/metadata/Metadata"; + +import { IProject } from "../../transformers/IProject"; + +import { FunctionImporter } from "../helpers/FunctionImporeter"; +import { ICheckEntry } from "../helpers/ICheckEntry"; +import { check_bigint } from "./check_bigint"; +import { check_number } from "./check_number"; +import { check_string } from "./check_string"; +import { check_template } from "./check_template"; + +export const check_dynamic_key = + (project: IProject) => + (importer: FunctionImporter) => + (input: ts.Expression, metadata: Metadata): ts.Expression => { + // IF PURE STRING EXISTS, THEN SKIP VALIDATION + if ( + (metadata.atomics.length !== 0 && + metadata.atomics.some( + (a) => + a.type === "string" && + a.tags.filter((row) => + row.every((t) => t.validate !== undefined), + ).length === 0, + )) || + (metadata.natives.length !== 0 && + metadata.natives.some((type) => type === "String")) + ) + return ts.factory.createTrue(); + + const conditions: ts.Expression[] = []; + + // NULLISH COALESCING + if (metadata.nullable === true) + conditions.push( + ts.factory.createStrictEquality( + ts.factory.createStringLiteral("null"), + input, + ), + ); + if (metadata.isRequired() === false) + conditions.push( + ts.factory.createStrictEquality( + ts.factory.createStringLiteral("undefined"), + input, + ), + ); + + // ATOMICS + for (const atom of metadata.atomics) + if (atom.type === "boolean") + conditions.push( + ts.factory.createLogicalOr( + ts.factory.createStrictEquality( + ts.factory.createStringLiteral("false"), + input, + ), + ts.factory.createStrictEquality( + ts.factory.createStringLiteral("true"), + input, + ), + ), + ); + else if (atom.type === "bigint") + conditions.push( + ts.factory.createLogicalAnd( + ts.factory.createCallExpression( + importer.use("is_bigint_string"), + undefined, + [input], + ), + atomist( + check_bigint(project)(atom)( + ts.factory.createCallExpression( + ts.factory.createIdentifier("BigInt"), + undefined, + [input], + ), + ), + ), + ), + ); + else if (atom.type === "number") + conditions.push( + atomist( + check_number(project, true)(atom)( + ts.factory.createCallExpression( + ts.factory.createIdentifier("Number"), + undefined, + [input], + ), + ), + ), + ); + else conditions.push(atomist(check_string(project)(atom)(input))); + + // CONSTANTS + for (const constant of metadata.constants) + for (const value of constant.values) + conditions.push( + ts.factory.createStrictEquality( + ts.factory.createStringLiteral(String(value)), + input, + ), + ); + + // TEMPLATES + if (!!metadata.templates.length) + conditions.push(atomist(check_template(metadata.templates)(input))); + + // NATIVES + for (const native of metadata.natives) + if (native === "Boolean") + conditions.push( + ts.factory.createLogicalOr( + ts.factory.createStrictEquality( + ts.factory.createStringLiteral("false"), + input, + ), + ts.factory.createStrictEquality( + ts.factory.createStringLiteral("true"), + input, + ), + ), + ); + else if (native === "BigInt") + conditions.push( + ts.factory.createCallExpression( + importer.use("is_bigint_string"), + undefined, + [input], + ), + ); + else if (native === "Number") + conditions.push( + ts.factory.createStrictEquality( + ts.factory.createFalse(), + ts.factory.createCallExpression( + ts.factory.createIdentifier("Number.isNaN"), + undefined, + [ + ts.factory.createCallExpression( + ts.factory.createIdentifier("Number"), + undefined, + [input], + ), + ], + ), + ), + ); + + return conditions.length === 0 + ? ts.factory.createTrue() + : conditions.length === 1 + ? conditions[0]! + : conditions.reduce(ts.factory.createLogicalOr); + }; + +const atomist = (entry: ICheckEntry) => { + return [ + ...(entry.expression ? [entry.expression] : []), + ...(entry.conditions.length === 0 + ? [] + : [ + entry.conditions + .map((set) => + set + .map((s) => s.expression) + .reduce((a, b) => + ts.factory.createLogicalAnd(a, b), + ), + ) + .reduce((a, b) => ts.factory.createLogicalOr(a, b)), + ]), + ].reduce((x, y) => ts.factory.createLogicalAnd(x, y)); +}; diff --git a/src/programmers/internal/check_dynamic_properties.ts b/src/programmers/internal/check_dynamic_properties.ts index bd3df3689e..a4accfadbc 100644 --- a/src/programmers/internal/check_dynamic_properties.ts +++ b/src/programmers/internal/check_dynamic_properties.ts @@ -3,17 +3,20 @@ import ts from "typescript"; import { IdentifierFactory } from "../../factories/IdentifierFactory"; import { StatementFactory } from "../../factories/StatementFactory"; +import { IProject } from "../../transformers/IProject"; + import { FunctionImporter } from "../helpers/FunctionImporeter"; import { IExpressionEntry } from "../helpers/IExpressionEntry"; +import { check_dynamic_key } from "./check_dynamic_key"; import { check_everything } from "./check_everything"; import { check_object } from "./check_object"; -import { metadata_to_pattern } from "./metadata_to_pattern"; /** * @internal */ export const check_dynamic_properties = (props: check_object.IProps) => + (project: IProject) => (importer: FunctionImporter) => ( input: ts.Expression, @@ -64,7 +67,11 @@ export const check_dynamic_properties = undefined, [input], ), - check_dynamic_property(props)(input, regular, dynamic), + check_dynamic_property(props)(project)(importer)( + input, + regular, + dynamic, + ), ]) : ts.factory.createCallExpression( IdentifierFactory.access( @@ -75,7 +82,13 @@ export const check_dynamic_properties = ), )(props.assert ? "every" : "map"), undefined, - [check_dynamic_property(props)(input, regular, dynamic)], + [ + check_dynamic_property(props)(project)(importer)( + input, + regular, + dynamic, + ), + ], ); const right: ts.Expression = (props.halt || ((elem) => elem))( props.assert ? criteria : check_everything(criteria), @@ -89,6 +102,8 @@ export const check_dynamic_properties = const check_dynamic_property = (props: check_object.IProps) => + (project: IProject) => + (importer: FunctionImporter) => ( input: ts.Expression, regular: IExpressionEntry[], @@ -129,15 +144,7 @@ const check_dynamic_property = for (const entry of dynamic) add( - ts.factory.createCallExpression( - ts.factory.createIdentifier( - `RegExp(/${metadata_to_pattern(true)( - entry.key, - )}/).test`, - ), - undefined, - [key], - ), + check_dynamic_key(project)(importer)(key, entry.key), entry.expression, ); diff --git a/src/programmers/internal/check_object.ts b/src/programmers/internal/check_object.ts index fcb8e219cb..bb1bd68e1a 100644 --- a/src/programmers/internal/check_object.ts +++ b/src/programmers/internal/check_object.ts @@ -1,5 +1,7 @@ import ts from "typescript"; +import { IProject } from "../../transformers/IProject"; + import { FunctionImporter } from "../helpers/FunctionImporeter"; import { IExpressionEntry } from "../helpers/IExpressionEntry"; import { check_dynamic_properties } from "./check_dynamic_properties"; @@ -10,6 +12,7 @@ import { check_everything } from "./check_everything"; */ export const check_object = (props: check_object.IProps) => + (project: IProject) => (importer: FunctionImporter) => (input: ts.Expression, entries: IExpressionEntry[]) => { // PREPARE ASSETS @@ -23,7 +26,11 @@ export const check_object = // CHECK DYNAMIC PROPERTIES flags.push( - check_dynamic_properties(props)(importer)(input, regular, dynamic), + check_dynamic_properties(props)(project)(importer)( + input, + regular, + dynamic, + ), ); return reduce(props)(flags); }; diff --git a/src/programmers/json/JsonStringifyProgrammer.ts b/src/programmers/json/JsonStringifyProgrammer.ts index b3fdb5ccb9..763e760dd4 100644 --- a/src/programmers/json/JsonStringifyProgrammer.ts +++ b/src/programmers/json/JsonStringifyProgrammer.ts @@ -905,7 +905,7 @@ export namespace JsonStringifyProgrammer { decoder: () => decode_object(importer), joiner: StringifyJoiner.object(importer), unionizer: decode_union_object( - IsProgrammer.decode_object(importer), + IsProgrammer.decode_object(project)(importer), )(decode_object(importer))((exp) => exp)( (value, expected) => create_throw_error(importer)(expected)(value), diff --git a/src/programmers/misc/MiscCloneProgrammer.ts b/src/programmers/misc/MiscCloneProgrammer.ts index 5792a87847..48a838a0eb 100644 --- a/src/programmers/misc/MiscCloneProgrammer.ts +++ b/src/programmers/misc/MiscCloneProgrammer.ts @@ -720,7 +720,7 @@ export namespace MiscCloneProgrammer { decoder: () => decode_object(importer), joiner: CloneJoiner.object, unionizer: decode_union_object( - IsProgrammer.decode_object(importer), + IsProgrammer.decode_object(project)(importer), )(decode_object(importer))((exp) => exp)( (input, expected) => create_throw_error(importer)(expected)(input), diff --git a/src/programmers/misc/MiscPruneProgrammer.ts b/src/programmers/misc/MiscPruneProgrammer.ts index 0dd33feef3..48d2764f91 100644 --- a/src/programmers/misc/MiscPruneProgrammer.ts +++ b/src/programmers/misc/MiscPruneProgrammer.ts @@ -490,7 +490,7 @@ export namespace MiscPruneProgrammer { decoder: () => decode_object(importer), joiner: PruneJoiner.object, unionizer: decode_union_object( - IsProgrammer.decode_object(importer), + IsProgrammer.decode_object(project)(importer), )(decode_object(importer))((exp) => exp)( (value, expected) => create_throw_error(importer)(expected)(value), diff --git a/src/programmers/notations/NotationGeneralProgrammer.ts b/src/programmers/notations/NotationGeneralProgrammer.ts index 0505db742b..072972e5e6 100644 --- a/src/programmers/notations/NotationGeneralProgrammer.ts +++ b/src/programmers/notations/NotationGeneralProgrammer.ts @@ -658,7 +658,7 @@ export namespace NotationGeneralProgrammer { decoder: () => decode_object(importer), joiner: NotationJoiner.object(rename), unionizer: decode_union_object( - IsProgrammer.decode_object(importer), + IsProgrammer.decode_object(project)(importer), )(decode_object(importer))((exp) => exp)( (input, expected) => create_throw_error(importer)(expected)(input), diff --git a/src/programmers/protobuf/ProtobufEncodeProgrammer.ts b/src/programmers/protobuf/ProtobufEncodeProgrammer.ts index 5c310c413f..5ffd9aee10 100644 --- a/src/programmers/protobuf/ProtobufEncodeProgrammer.ts +++ b/src/programmers/protobuf/ProtobufEncodeProgrammer.ts @@ -765,7 +765,7 @@ export namespace ProtobufEncodeProgrammer { if (specList.length === 0) { const condition: ts.Expression = decode_union_object( - IsProgrammer.decode_object(importer), + IsProgrammer.decode_object(project)(importer), )((i, o, e) => ExpressionFactory.selfCall( decode_object(project)(importer)(indexes!.get(o)!)( diff --git a/test/features/assert/test_assert_DynamicTag.ts b/test/features/assert/test_assert_DynamicTag.ts new file mode 100644 index 0000000000..02a7f47692 --- /dev/null +++ b/test/features/assert/test_assert_DynamicTag.ts @@ -0,0 +1,7 @@ +import typia from "../../../src"; +import { _test_assert } from "../../internal/_test_assert"; +import { DynamicTag } from "../../structures/DynamicTag"; + +export const test_assert_DynamicTag = _test_assert("DynamicTag")( + DynamicTag, +)((input) => typia.assert(input)); diff --git a/test/features/assertEquals/test_assertEquals_DynamicTag.ts b/test/features/assertEquals/test_assertEquals_DynamicTag.ts new file mode 100644 index 0000000000..6618cebd14 --- /dev/null +++ b/test/features/assertEquals/test_assertEquals_DynamicTag.ts @@ -0,0 +1,7 @@ +import typia from "../../../src"; +import { _test_assertEquals } from "../../internal/_test_assertEquals"; +import { DynamicTag } from "../../structures/DynamicTag"; + +export const test_assertEquals_DynamicTag = _test_assertEquals( + "DynamicTag", +)(DynamicTag)((input) => typia.assertEquals(input)); diff --git a/test/features/createAssert/test_createAssert_DynamicTag.ts b/test/features/createAssert/test_createAssert_DynamicTag.ts new file mode 100644 index 0000000000..65efd2c27c --- /dev/null +++ b/test/features/createAssert/test_createAssert_DynamicTag.ts @@ -0,0 +1,7 @@ +import typia from "../../../src"; +import { _test_assert } from "../../internal/_test_assert"; +import { DynamicTag } from "../../structures/DynamicTag"; + +export const test_createAssert_DynamicTag = _test_assert( + "DynamicTag", +)(DynamicTag)(typia.createAssert()); diff --git a/test/features/createAssertEquals/test_createAssertEquals_DynamicTag.ts b/test/features/createAssertEquals/test_createAssertEquals_DynamicTag.ts new file mode 100644 index 0000000000..c9f7bdebc8 --- /dev/null +++ b/test/features/createAssertEquals/test_createAssertEquals_DynamicTag.ts @@ -0,0 +1,7 @@ +import typia from "../../../src"; +import { _test_assertEquals } from "../../internal/_test_assertEquals"; +import { DynamicTag } from "../../structures/DynamicTag"; + +export const test_createAssertEquals_DynamicTag = _test_assertEquals( + "DynamicTag", +)(DynamicTag)(typia.createAssertEquals()); diff --git a/test/features/createEquals/test_createEquals_DynamicTag.ts b/test/features/createEquals/test_createEquals_DynamicTag.ts new file mode 100644 index 0000000000..53ddb0f0be --- /dev/null +++ b/test/features/createEquals/test_createEquals_DynamicTag.ts @@ -0,0 +1,7 @@ +import typia from "../../../src"; +import { _test_equals } from "../../internal/_test_equals"; +import { DynamicTag } from "../../structures/DynamicTag"; + +export const test_createEquals_DynamicTag = _test_equals( + "DynamicTag", +)(DynamicTag)(typia.createEquals()); diff --git a/test/features/createIs/test_createIs_DynamicTag.ts b/test/features/createIs/test_createIs_DynamicTag.ts new file mode 100644 index 0000000000..b45f0b7817 --- /dev/null +++ b/test/features/createIs/test_createIs_DynamicTag.ts @@ -0,0 +1,7 @@ +import typia from "../../../src"; +import { _test_is } from "../../internal/_test_is"; +import { DynamicTag } from "../../structures/DynamicTag"; + +export const test_createIs_DynamicTag = _test_is("DynamicTag")( + DynamicTag, +)(typia.createIs()); diff --git a/test/features/createRandom/test_createRandom_DynamicTag.ts b/test/features/createRandom/test_createRandom_DynamicTag.ts new file mode 100644 index 0000000000..8298da2ee6 --- /dev/null +++ b/test/features/createRandom/test_createRandom_DynamicTag.ts @@ -0,0 +1,10 @@ +import typia from "../../../src"; +import { _test_random } from "../../internal/_test_random"; +import { DynamicTag } from "../../structures/DynamicTag"; + +export const test_createRandom_DynamicTag = _test_random( + "DynamicTag", +)(DynamicTag)({ + random: typia.createRandom((DynamicTag as any).RANDOM), + assert: typia.createAssert(), +}); diff --git a/test/features/createValidate/test_createValidate_DynamicTag.ts b/test/features/createValidate/test_createValidate_DynamicTag.ts new file mode 100644 index 0000000000..803d174fea --- /dev/null +++ b/test/features/createValidate/test_createValidate_DynamicTag.ts @@ -0,0 +1,7 @@ +import typia from "../../../src"; +import { _test_validate } from "../../internal/_test_validate"; +import { DynamicTag } from "../../structures/DynamicTag"; + +export const test_createValidate_DynamicTag = _test_validate( + "DynamicTag", +)(DynamicTag)(typia.createValidate()); diff --git a/test/features/createValidateEquals/test_createValidateEquals_DynamicTag.ts b/test/features/createValidateEquals/test_createValidateEquals_DynamicTag.ts new file mode 100644 index 0000000000..08bb6aaa09 --- /dev/null +++ b/test/features/createValidateEquals/test_createValidateEquals_DynamicTag.ts @@ -0,0 +1,7 @@ +import typia from "../../../src"; +import { _test_validateEquals } from "../../internal/_test_validateEquals"; +import { DynamicTag } from "../../structures/DynamicTag"; + +export const test_createValidateEquals_DynamicTag = _test_validateEquals( + "DynamicTag", +)(DynamicTag)(typia.createValidateEquals()); diff --git a/test/features/equals/test_equals_DynamicTag.ts b/test/features/equals/test_equals_DynamicTag.ts new file mode 100644 index 0000000000..f27456cfdc --- /dev/null +++ b/test/features/equals/test_equals_DynamicTag.ts @@ -0,0 +1,7 @@ +import typia from "../../../src"; +import { _test_equals } from "../../internal/_test_equals"; +import { DynamicTag } from "../../structures/DynamicTag"; + +export const test_equals_DynamicTag = _test_equals("DynamicTag")( + DynamicTag, +)((input) => typia.equals(input)); diff --git a/test/features/is/test_is_DynamicTag.ts b/test/features/is/test_is_DynamicTag.ts new file mode 100644 index 0000000000..9b3801bb93 --- /dev/null +++ b/test/features/is/test_is_DynamicTag.ts @@ -0,0 +1,7 @@ +import typia from "../../../src"; +import { _test_is } from "../../internal/_test_is"; +import { DynamicTag } from "../../structures/DynamicTag"; + +export const test_is_DynamicTag = _test_is("DynamicTag")( + DynamicTag, +)((input) => typia.is(input)); diff --git a/test/features/misc.assertPrune/test_misc_assertPrune_DynamicTag.ts b/test/features/misc.assertPrune/test_misc_assertPrune_DynamicTag.ts new file mode 100644 index 0000000000..e2bff873cc --- /dev/null +++ b/test/features/misc.assertPrune/test_misc_assertPrune_DynamicTag.ts @@ -0,0 +1,7 @@ +import typia from "../../../src"; +import { _test_misc_assertPrune } from "../../internal/_test_misc_assertPrune"; +import { DynamicTag } from "../../structures/DynamicTag"; + +export const test_misc_assertPrune_DynamicTag = _test_misc_assertPrune( + "DynamicTag", +)(DynamicTag)((input) => typia.misc.assertPrune(input)); diff --git a/test/features/misc.createAssertPrune/test_misc_createAssertPrune_DynamicTag.ts b/test/features/misc.createAssertPrune/test_misc_createAssertPrune_DynamicTag.ts new file mode 100644 index 0000000000..1c13615aee --- /dev/null +++ b/test/features/misc.createAssertPrune/test_misc_createAssertPrune_DynamicTag.ts @@ -0,0 +1,7 @@ +import typia from "../../../src"; +import { _test_misc_assertPrune } from "../../internal/_test_misc_assertPrune"; +import { DynamicTag } from "../../structures/DynamicTag"; + +export const test_misc_createAssertPrune_DynamicTag = _test_misc_assertPrune( + "DynamicTag", +)(DynamicTag)(typia.misc.createAssertPrune()); diff --git a/test/features/misc.createIsPrune/test_misc_createIsPrune_DynamicTag.ts b/test/features/misc.createIsPrune/test_misc_createIsPrune_DynamicTag.ts new file mode 100644 index 0000000000..7ca7b91d7d --- /dev/null +++ b/test/features/misc.createIsPrune/test_misc_createIsPrune_DynamicTag.ts @@ -0,0 +1,7 @@ +import typia from "../../../src"; +import { _test_misc_isPrune } from "../../internal/_test_misc_isPrune"; +import { DynamicTag } from "../../structures/DynamicTag"; + +export const test_misc_createIsPrune_DynamicTag = _test_misc_isPrune( + "DynamicTag", +)(DynamicTag)(typia.misc.createIsPrune()); diff --git a/test/features/misc.createPrune/test_misc_createPrune_DynamicTag.ts b/test/features/misc.createPrune/test_misc_createPrune_DynamicTag.ts new file mode 100644 index 0000000000..27278af514 --- /dev/null +++ b/test/features/misc.createPrune/test_misc_createPrune_DynamicTag.ts @@ -0,0 +1,7 @@ +import typia from "../../../src"; +import { _test_misc_prune } from "../../internal/_test_misc_prune"; +import { DynamicTag } from "../../structures/DynamicTag"; + +export const test_misc_createPrune_DynamicTag = _test_misc_prune( + "DynamicTag", +)(DynamicTag)(typia.misc.createPrune()); diff --git a/test/features/misc.createValidatePrune/test_misc_createValidatePrune_DynamicTag.ts b/test/features/misc.createValidatePrune/test_misc_createValidatePrune_DynamicTag.ts new file mode 100644 index 0000000000..eb95ec1f81 --- /dev/null +++ b/test/features/misc.createValidatePrune/test_misc_createValidatePrune_DynamicTag.ts @@ -0,0 +1,8 @@ +import typia from "../../../src"; +import { _test_misc_validatePrune } from "../../internal/_test_misc_validatePrune"; +import { DynamicTag } from "../../structures/DynamicTag"; + +export const test_misc_createValidatePrune_DynamicTag = + _test_misc_validatePrune("DynamicTag")(DynamicTag)( + typia.misc.createValidatePrune(), + ); diff --git a/test/features/misc.isPrune/test_misc_isPrune_DynamicTag.ts b/test/features/misc.isPrune/test_misc_isPrune_DynamicTag.ts new file mode 100644 index 0000000000..2e06691c9c --- /dev/null +++ b/test/features/misc.isPrune/test_misc_isPrune_DynamicTag.ts @@ -0,0 +1,7 @@ +import typia from "../../../src"; +import { _test_misc_isPrune } from "../../internal/_test_misc_isPrune"; +import { DynamicTag } from "../../structures/DynamicTag"; + +export const test_misc_isPrune_DynamicTag = _test_misc_isPrune( + "DynamicTag", +)(DynamicTag)((input) => typia.misc.isPrune(input)); diff --git a/test/features/misc.prune/test_misc_prune_DynamicTag.ts b/test/features/misc.prune/test_misc_prune_DynamicTag.ts new file mode 100644 index 0000000000..3f371072ad --- /dev/null +++ b/test/features/misc.prune/test_misc_prune_DynamicTag.ts @@ -0,0 +1,7 @@ +import typia from "../../../src"; +import { _test_misc_prune } from "../../internal/_test_misc_prune"; +import { DynamicTag } from "../../structures/DynamicTag"; + +export const test_misc_prune_DynamicTag = _test_misc_prune( + "DynamicTag", +)(DynamicTag)((input) => typia.misc.prune(input)); diff --git a/test/features/misc.validatePrune/test_misc_validatePrune_DynamicTag.ts b/test/features/misc.validatePrune/test_misc_validatePrune_DynamicTag.ts new file mode 100644 index 0000000000..974dd7cc51 --- /dev/null +++ b/test/features/misc.validatePrune/test_misc_validatePrune_DynamicTag.ts @@ -0,0 +1,9 @@ +import typia from "../../../src"; +import { _test_misc_validatePrune } from "../../internal/_test_misc_validatePrune"; +import { DynamicTag } from "../../structures/DynamicTag"; + +export const test_misc_validatePrune_DynamicTag = _test_misc_validatePrune( + "DynamicTag", +)(DynamicTag)((input) => + typia.misc.validatePrune(input), +); diff --git a/test/features/notation.camel/test_notation_camel_DynamicTag.ts b/test/features/notation.camel/test_notation_camel_DynamicTag.ts new file mode 100644 index 0000000000..c6604fa711 --- /dev/null +++ b/test/features/notation.camel/test_notation_camel_DynamicTag.ts @@ -0,0 +1,11 @@ +import typia from "../../../src"; +import { _test_notation_validateGeneral } from "../../internal/_test_notation_validateGeneral"; +import { DynamicTag } from "../../structures/DynamicTag"; + +export const test_notation_validateCamel_DynamicTag = + _test_notation_validateGeneral("DynamicTag")(DynamicTag)< + typia.CamelCase + >({ + convert: (input) => typia.notations.validateCamel(input), + assert: typia.createAssert>(), + }); diff --git a/test/features/notation.createCamel/test_notation_createCamel_DynamicTag.ts b/test/features/notation.createCamel/test_notation_createCamel_DynamicTag.ts new file mode 100644 index 0000000000..53f7d49611 --- /dev/null +++ b/test/features/notation.createCamel/test_notation_createCamel_DynamicTag.ts @@ -0,0 +1,11 @@ +import typia from "../../../src"; +import { _test_notation_validateGeneral } from "../../internal/_test_notation_validateGeneral"; +import { DynamicTag } from "../../structures/DynamicTag"; + +export const test_notation_createValidateCamel_DynamicTag = + _test_notation_validateGeneral("DynamicTag")(DynamicTag)< + typia.CamelCase + >({ + convert: typia.notations.createValidateCamel(), + assert: typia.createAssert>(), + }); diff --git a/test/features/notation.createPascal/test_notation_createPascal_DynamicTag.ts b/test/features/notation.createPascal/test_notation_createPascal_DynamicTag.ts new file mode 100644 index 0000000000..3426f97dd4 --- /dev/null +++ b/test/features/notation.createPascal/test_notation_createPascal_DynamicTag.ts @@ -0,0 +1,11 @@ +import typia from "../../../src"; +import { _test_notation_validateGeneral } from "../../internal/_test_notation_validateGeneral"; +import { DynamicTag } from "../../structures/DynamicTag"; + +export const test_notation_createValidatePascal_DynamicTag = + _test_notation_validateGeneral("DynamicTag")(DynamicTag)< + typia.PascalCase + >({ + convert: typia.notations.createValidatePascal(), + assert: typia.createAssert>(), + }); diff --git a/test/features/notation.createSnake/test_notation_createSnake_DynamicTag.ts b/test/features/notation.createSnake/test_notation_createSnake_DynamicTag.ts new file mode 100644 index 0000000000..6c5bb6698e --- /dev/null +++ b/test/features/notation.createSnake/test_notation_createSnake_DynamicTag.ts @@ -0,0 +1,11 @@ +import typia from "../../../src"; +import { _test_notation_validateGeneral } from "../../internal/_test_notation_validateGeneral"; +import { DynamicTag } from "../../structures/DynamicTag"; + +export const test_notation_createValidateSnake_DynamicTag = + _test_notation_validateGeneral("DynamicTag")(DynamicTag)< + typia.SnakeCase + >({ + convert: typia.notations.createValidateSnake(), + assert: typia.createAssert>(), + }); diff --git a/test/features/notation.pascal/test_notation_pascal_DynamicTag.ts b/test/features/notation.pascal/test_notation_pascal_DynamicTag.ts new file mode 100644 index 0000000000..ca6ccbf0d6 --- /dev/null +++ b/test/features/notation.pascal/test_notation_pascal_DynamicTag.ts @@ -0,0 +1,11 @@ +import typia from "../../../src"; +import { _test_notation_validateGeneral } from "../../internal/_test_notation_validateGeneral"; +import { DynamicTag } from "../../structures/DynamicTag"; + +export const test_notation_validatePascal_DynamicTag = + _test_notation_validateGeneral("DynamicTag")(DynamicTag)< + typia.PascalCase + >({ + convert: (input) => typia.notations.validatePascal(input), + assert: typia.createAssert>(), + }); diff --git a/test/features/notation.snake/test_notation_snake_DynamicTag.ts b/test/features/notation.snake/test_notation_snake_DynamicTag.ts new file mode 100644 index 0000000000..30d5742451 --- /dev/null +++ b/test/features/notation.snake/test_notation_snake_DynamicTag.ts @@ -0,0 +1,11 @@ +import typia from "../../../src"; +import { _test_notation_validateGeneral } from "../../internal/_test_notation_validateGeneral"; +import { DynamicTag } from "../../structures/DynamicTag"; + +export const test_notation_validateSnake_DynamicTag = + _test_notation_validateGeneral("DynamicTag")(DynamicTag)< + typia.SnakeCase + >({ + convert: (input) => typia.notations.validateSnake(input), + assert: typia.createAssert>(), + }); diff --git a/test/features/random/test_random_DynamicTag.ts b/test/features/random/test_random_DynamicTag.ts new file mode 100644 index 0000000000..b8eb3e8edf --- /dev/null +++ b/test/features/random/test_random_DynamicTag.ts @@ -0,0 +1,10 @@ +import typia from "../../../src"; +import { _test_random } from "../../internal/_test_random"; +import { DynamicTag } from "../../structures/DynamicTag"; + +export const test_random_DynamicTag = _test_random("DynamicTag")( + DynamicTag, +)({ + random: () => typia.random((DynamicTag as any).RANDOM), + assert: typia.createAssert(), +}); diff --git a/test/features/validate/test_validate_DynamicTag.ts b/test/features/validate/test_validate_DynamicTag.ts new file mode 100644 index 0000000000..53d9486e85 --- /dev/null +++ b/test/features/validate/test_validate_DynamicTag.ts @@ -0,0 +1,7 @@ +import typia from "../../../src"; +import { _test_validate } from "../../internal/_test_validate"; +import { DynamicTag } from "../../structures/DynamicTag"; + +export const test_validate_DynamicTag = _test_validate( + "DynamicTag", +)(DynamicTag)((input) => typia.validate(input)); diff --git a/test/features/validateEquals/test_validateEquals_DynamicTag.ts b/test/features/validateEquals/test_validateEquals_DynamicTag.ts new file mode 100644 index 0000000000..752142108f --- /dev/null +++ b/test/features/validateEquals/test_validateEquals_DynamicTag.ts @@ -0,0 +1,7 @@ +import typia from "../../../src"; +import { _test_validateEquals } from "../../internal/_test_validateEquals"; +import { DynamicTag } from "../../structures/DynamicTag"; + +export const test_validateEquals_DynamicTag = _test_validateEquals( + "DynamicTag", +)(DynamicTag)((input) => typia.validateEquals(input)); diff --git a/test/generated/output/assert/test_assert_DynamicComposite.ts b/test/generated/output/assert/test_assert_DynamicComposite.ts index 1973b16486..f2b1ea435c 100644 --- a/test/generated/output/assert/test_assert_DynamicComposite.ts +++ b/test/generated/output/assert/test_assert_DynamicComposite.ts @@ -16,20 +16,26 @@ export const test_assert_DynamicComposite = _test_assert( const value = input[key]; if (undefined === value) return true; if ( - RegExp(/^[+-]?\d+(?:\.\d+)?(?:[eE][+-]?\d+)?$/).test( - key, - ) + "number" === typeof Number(key) && + Number.isFinite(Number(key)) ) return ( "number" === typeof value && Number.isFinite(value) ); - if (RegExp(/^(prefix_(.*))/).test(key)) + if ( + "string" === typeof key && + RegExp(/^prefix_(.*)/).test(key) + ) return "string" === typeof value; - if (RegExp(/((.*)_postfix)$/).test(key)) + if ( + "string" === typeof key && + RegExp(/(.*)_postfix$/).test(key) + ) return "string" === typeof value; if ( + "string" === typeof key && RegExp( - /^(value_[+-]?\d+(?:\.\d+)?(?:[eE][+-]?\d+)?)$/, + /^value_[+-]?\d+(?:\.\d+)?(?:[eE][+-]?\d+)?$/, ).test(key) ) return ( @@ -39,8 +45,9 @@ export const test_assert_DynamicComposite = _test_assert( "boolean" === typeof value ); if ( + "string" === typeof key && RegExp( - /^(between_(.*)_and_[+-]?\d+(?:\.\d+)?(?:[eE][+-]?\d+)?)$/, + /^between_(.*)_and_[+-]?\d+(?:\.\d+)?(?:[eE][+-]?\d+)?$/, ).test(key) ) return "boolean" === typeof value; @@ -82,9 +89,8 @@ export const test_assert_DynamicComposite = _test_assert( const value = input[key]; if (undefined === value) return true; if ( - RegExp( - /^[+-]?\d+(?:\.\d+)?(?:[eE][+-]?\d+)?$/, - ).test(key) + "number" === typeof Number(key) && + Number.isFinite(Number(key)) ) return ( ("number" === typeof value && @@ -95,7 +101,10 @@ export const test_assert_DynamicComposite = _test_assert( value: value, }) ); - if (RegExp(/^(prefix_(.*))/).test(key)) + if ( + "string" === typeof key && + RegExp(/^prefix_(.*)/).test(key) + ) return ( "string" === typeof value || $guard(_exceptionable, { @@ -104,7 +113,10 @@ export const test_assert_DynamicComposite = _test_assert( value: value, }) ); - if (RegExp(/((.*)_postfix)$/).test(key)) + if ( + "string" === typeof key && + RegExp(/(.*)_postfix$/).test(key) + ) return ( "string" === typeof value || $guard(_exceptionable, { @@ -114,8 +126,9 @@ export const test_assert_DynamicComposite = _test_assert( }) ); if ( + "string" === typeof key && RegExp( - /^(value_[+-]?\d+(?:\.\d+)?(?:[eE][+-]?\d+)?)$/, + /^value_[+-]?\d+(?:\.\d+)?(?:[eE][+-]?\d+)?$/, ).test(key) ) return ( @@ -130,8 +143,9 @@ export const test_assert_DynamicComposite = _test_assert( }) ); if ( + "string" === typeof key && RegExp( - /^(between_(.*)_and_[+-]?\d+(?:\.\d+)?(?:[eE][+-]?\d+)?)$/, + /^between_(.*)_and_[+-]?\d+(?:\.\d+)?(?:[eE][+-]?\d+)?$/, ).test(key) ) return ( diff --git a/test/generated/output/assert/test_assert_DynamicJsonValue.ts b/test/generated/output/assert/test_assert_DynamicJsonValue.ts index 02d961e344..55ad2b2b89 100644 --- a/test/generated/output/assert/test_assert_DynamicJsonValue.ts +++ b/test/generated/output/assert/test_assert_DynamicJsonValue.ts @@ -11,7 +11,7 @@ export const test_assert_DynamicJsonValue = _test_assert( Object.keys(input).every((key: any) => { const value = input[key]; if (undefined === value) return true; - if (RegExp(/(.*)/).test(key)) + if (true) return ( null === value || undefined === value || @@ -72,7 +72,7 @@ export const test_assert_DynamicJsonValue = _test_assert( Object.keys(input).every((key: any) => { const value = input[key]; if (undefined === value) return true; - if (RegExp(/(.*)/).test(key)) + if (true) return ( null === value || undefined === value || diff --git a/test/generated/output/assert/test_assert_DynamicNever.ts b/test/generated/output/assert/test_assert_DynamicNever.ts index 888d9a0a78..79dd6cfb60 100644 --- a/test/generated/output/assert/test_assert_DynamicNever.ts +++ b/test/generated/output/assert/test_assert_DynamicNever.ts @@ -11,8 +11,7 @@ export const test_assert_DynamicNever = _test_assert( Object.keys(input).every((key: any) => { const value = input[key]; if (undefined === value) return true; - if (RegExp(/(.*)/).test(key)) - return null !== value && undefined === value; + if (true) return null !== value && undefined === value; return true; }); return ( @@ -39,7 +38,7 @@ export const test_assert_DynamicNever = _test_assert( Object.keys(input).every((key: any) => { const value = input[key]; if (undefined === value) return true; - if (RegExp(/(.*)/).test(key)) + if (true) return ( (null !== value || $guard(_exceptionable, { diff --git a/test/generated/output/assert/test_assert_DynamicTag.ts b/test/generated/output/assert/test_assert_DynamicTag.ts new file mode 100644 index 0000000000..d6f6952e4f --- /dev/null +++ b/test/generated/output/assert/test_assert_DynamicTag.ts @@ -0,0 +1,121 @@ +import typia from "../../../../src"; +import { _test_assert } from "../../../internal/_test_assert"; +import { DynamicTag } from "../../../structures/DynamicTag"; + +export const test_assert_DynamicTag = _test_assert("DynamicTag")( + DynamicTag, +)((input) => + ((input: any): DynamicTag => { + const __is = (input: any): input is DynamicTag => { + const $io0 = (input: any): boolean => + Object.keys(input).every((key: any) => { + const value = input[key]; + if (undefined === value) return true; + if ( + "number" === typeof Number(key) && + 0 <= Number(key) && + Number(key) < 10 + ) + return "bigint" === typeof value && BigInt(0) <= value; + if ( + "string" === typeof key && + /^(?:[0-9a-f]{8}-[0-9a-f]{4}-[1-5][0-9a-f]{3}-[89ab][0-9a-f]{3}-[0-9a-f]{12}|00000000-0000-0000-0000-000000000000)$/i.test( + key, + ) + ) + return ( + "string" === typeof value && + /^(([^<>()[\]\.,;:\s@\"]+(\.[^<>()[\]\.,;:\s@\"]+)*)|(\".+\"))@(([^<>()[\]\.,;:\s@\"]+\.)+[^<>()[\]\.,;:\s@\"]{2,})$/i.test( + value, + ) + ); + return true; + }); + return ( + "object" === typeof input && + null !== input && + false === Array.isArray(input) && + $io0(input) + ); + }; + if (false === __is(input)) + (( + input: any, + _path: string, + _exceptionable: boolean = true, + ): input is DynamicTag => { + const $guard = (typia.assert as any).guard; + const $join = (typia.assert as any).join; + const $ao0 = ( + input: any, + _path: string, + _exceptionable: boolean = true, + ): boolean => + false === _exceptionable || + Object.keys(input).every((key: any) => { + const value = input[key]; + if (undefined === value) return true; + if ( + "number" === typeof Number(key) && + 0 <= Number(key) && + Number(key) < 10 + ) + return ( + ("bigint" === typeof value && + (BigInt(0) <= value || + $guard(_exceptionable, { + path: _path + $join(key), + expected: 'bigint & Type<"uint64">', + value: value, + }))) || + $guard(_exceptionable, { + path: _path + $join(key), + expected: '(bigint & Type<"uint64">)', + value: value, + }) + ); + if ( + "string" === typeof key && + /^(?:[0-9a-f]{8}-[0-9a-f]{4}-[1-5][0-9a-f]{3}-[89ab][0-9a-f]{3}-[0-9a-f]{12}|00000000-0000-0000-0000-000000000000)$/i.test( + key, + ) + ) + return ( + ("string" === typeof value && + (/^(([^<>()[\]\.,;:\s@\"]+(\.[^<>()[\]\.,;:\s@\"]+)*)|(\".+\"))@(([^<>()[\]\.,;:\s@\"]+\.)+[^<>()[\]\.,;:\s@\"]{2,})$/i.test( + value, + ) || + $guard(_exceptionable, { + path: _path + $join(key), + expected: + 'string & Format<"email">', + value: value, + }))) || + $guard(_exceptionable, { + path: _path + $join(key), + expected: '(string & Format<"email">)', + value: value, + }) + ); + return true; + }); + return ( + ((("object" === typeof input && + null !== input && + false === Array.isArray(input)) || + $guard(true, { + path: _path + "", + expected: "DynamicTag", + value: input, + })) && + $ao0(input, _path + "", true)) || + $guard(true, { + path: _path + "", + expected: "DynamicTag", + value: input, + }) + ); + })(input, "$input", true); + return input; + })(input), +); diff --git a/test/generated/output/assert/test_assert_DynamicTemplate.ts b/test/generated/output/assert/test_assert_DynamicTemplate.ts index 706bc4dfea..33aeebebca 100644 --- a/test/generated/output/assert/test_assert_DynamicTemplate.ts +++ b/test/generated/output/assert/test_assert_DynamicTemplate.ts @@ -11,21 +11,29 @@ export const test_assert_DynamicTemplate = _test_assert( Object.keys(input).every((key: any) => { const value = input[key]; if (undefined === value) return true; - if (RegExp(/^(prefix_(.*))/).test(key)) + if ( + "string" === typeof key && + RegExp(/^prefix_(.*)/).test(key) + ) return "string" === typeof value; - if (RegExp(/((.*)_postfix)$/).test(key)) + if ( + "string" === typeof key && + RegExp(/(.*)_postfix$/).test(key) + ) return "string" === typeof value; if ( + "string" === typeof key && RegExp( - /^(value_[+-]?\d+(?:\.\d+)?(?:[eE][+-]?\d+)?)$/, + /^value_[+-]?\d+(?:\.\d+)?(?:[eE][+-]?\d+)?$/, ).test(key) ) return ( "number" === typeof value && Number.isFinite(value) ); if ( + "string" === typeof key && RegExp( - /^(between_(.*)_and_[+-]?\d+(?:\.\d+)?(?:[eE][+-]?\d+)?)$/, + /^between_(.*)_and_[+-]?\d+(?:\.\d+)?(?:[eE][+-]?\d+)?$/, ).test(key) ) return "boolean" === typeof value; @@ -55,7 +63,10 @@ export const test_assert_DynamicTemplate = _test_assert( Object.keys(input).every((key: any) => { const value = input[key]; if (undefined === value) return true; - if (RegExp(/^(prefix_(.*))/).test(key)) + if ( + "string" === typeof key && + RegExp(/^prefix_(.*)/).test(key) + ) return ( "string" === typeof value || $guard(_exceptionable, { @@ -64,7 +75,10 @@ export const test_assert_DynamicTemplate = _test_assert( value: value, }) ); - if (RegExp(/((.*)_postfix)$/).test(key)) + if ( + "string" === typeof key && + RegExp(/(.*)_postfix$/).test(key) + ) return ( "string" === typeof value || $guard(_exceptionable, { @@ -74,8 +88,9 @@ export const test_assert_DynamicTemplate = _test_assert( }) ); if ( + "string" === typeof key && RegExp( - /^(value_[+-]?\d+(?:\.\d+)?(?:[eE][+-]?\d+)?)$/, + /^value_[+-]?\d+(?:\.\d+)?(?:[eE][+-]?\d+)?$/, ).test(key) ) return ( @@ -88,8 +103,9 @@ export const test_assert_DynamicTemplate = _test_assert( }) ); if ( + "string" === typeof key && RegExp( - /^(between_(.*)_and_[+-]?\d+(?:\.\d+)?(?:[eE][+-]?\d+)?)$/, + /^between_(.*)_and_[+-]?\d+(?:\.\d+)?(?:[eE][+-]?\d+)?$/, ).test(key) ) return ( diff --git a/test/generated/output/assert/test_assert_DynamicTree.ts b/test/generated/output/assert/test_assert_DynamicTree.ts index fbb4bebe4e..4db3612276 100644 --- a/test/generated/output/assert/test_assert_DynamicTree.ts +++ b/test/generated/output/assert/test_assert_DynamicTree.ts @@ -19,7 +19,7 @@ export const test_assert_DynamicTree = _test_assert("DynamicTree")( Object.keys(input).every((key: any) => { const value = input[key]; if (undefined === value) return true; - if (RegExp(/(.*)/).test(key)) + if (true) return ( "object" === typeof value && null !== value && @@ -82,7 +82,7 @@ export const test_assert_DynamicTree = _test_assert("DynamicTree")( Object.keys(input).every((key: any) => { const value = input[key]; if (undefined === value) return true; - if (RegExp(/(.*)/).test(key)) + if (true) return ( ((("object" === typeof value && null !== value) || diff --git a/test/generated/output/assert/test_assert_DynamicUndefined.ts b/test/generated/output/assert/test_assert_DynamicUndefined.ts index fd1d17e3d4..c93636aba3 100644 --- a/test/generated/output/assert/test_assert_DynamicUndefined.ts +++ b/test/generated/output/assert/test_assert_DynamicUndefined.ts @@ -11,8 +11,7 @@ export const test_assert_DynamicUndefined = _test_assert( Object.keys(input).every((key: any) => { const value = input[key]; if (undefined === value) return true; - if (RegExp(/(.*)/).test(key)) - return null !== value && undefined === value; + if (true) return null !== value && undefined === value; return true; }); return ( @@ -39,7 +38,7 @@ export const test_assert_DynamicUndefined = _test_assert( Object.keys(input).every((key: any) => { const value = input[key]; if (undefined === value) return true; - if (RegExp(/(.*)/).test(key)) + if (true) return ( (null !== value || $guard(_exceptionable, { diff --git a/test/generated/output/assert/test_assert_DynamicUnion.ts b/test/generated/output/assert/test_assert_DynamicUnion.ts index 45e7c34e50..4e63bdba28 100644 --- a/test/generated/output/assert/test_assert_DynamicUnion.ts +++ b/test/generated/output/assert/test_assert_DynamicUnion.ts @@ -12,18 +12,24 @@ export const test_assert_DynamicUnion = _test_assert( const value = input[key]; if (undefined === value) return true; if ( - RegExp(/^[+-]?\d+(?:\.\d+)?(?:[eE][+-]?\d+)?$/).test( - key, - ) + "number" === typeof Number(key) && + Number.isFinite(Number(key)) ) return "string" === typeof value; - if (RegExp(/^(prefix_(.*))/).test(key)) + if ( + "string" === typeof key && + RegExp(/^prefix_(.*)/).test(key) + ) return "string" === typeof value; - if (RegExp(/((.*)_postfix)$/).test(key)) + if ( + "string" === typeof key && + RegExp(/(.*)_postfix$/).test(key) + ) return "string" === typeof value; if ( + "string" === typeof key && RegExp( - /^(value_between_[+-]?\d+(?:\.\d+)?(?:[eE][+-]?\d+)?_and_[+-]?\d+(?:\.\d+)?(?:[eE][+-]?\d+)?)$/, + /^value_between_[+-]?\d+(?:\.\d+)?(?:[eE][+-]?\d+)?_and_[+-]?\d+(?:\.\d+)?(?:[eE][+-]?\d+)?$/, ).test(key) ) return ( @@ -56,9 +62,8 @@ export const test_assert_DynamicUnion = _test_assert( const value = input[key]; if (undefined === value) return true; if ( - RegExp( - /^[+-]?\d+(?:\.\d+)?(?:[eE][+-]?\d+)?$/, - ).test(key) + "number" === typeof Number(key) && + Number.isFinite(Number(key)) ) return ( "string" === typeof value || @@ -68,7 +73,10 @@ export const test_assert_DynamicUnion = _test_assert( value: value, }) ); - if (RegExp(/^(prefix_(.*))/).test(key)) + if ( + "string" === typeof key && + RegExp(/^prefix_(.*)/).test(key) + ) return ( "string" === typeof value || $guard(_exceptionable, { @@ -77,7 +85,10 @@ export const test_assert_DynamicUnion = _test_assert( value: value, }) ); - if (RegExp(/((.*)_postfix)$/).test(key)) + if ( + "string" === typeof key && + RegExp(/(.*)_postfix$/).test(key) + ) return ( "string" === typeof value || $guard(_exceptionable, { @@ -87,8 +98,9 @@ export const test_assert_DynamicUnion = _test_assert( }) ); if ( + "string" === typeof key && RegExp( - /^(value_between_[+-]?\d+(?:\.\d+)?(?:[eE][+-]?\d+)?_and_[+-]?\d+(?:\.\d+)?(?:[eE][+-]?\d+)?)$/, + /^value_between_[+-]?\d+(?:\.\d+)?(?:[eE][+-]?\d+)?_and_[+-]?\d+(?:\.\d+)?(?:[eE][+-]?\d+)?$/, ).test(key) ) return ( diff --git a/test/generated/output/assert/test_assert_ObjectDynamic.ts b/test/generated/output/assert/test_assert_ObjectDynamic.ts index 7d94df31f9..185dca7a86 100644 --- a/test/generated/output/assert/test_assert_ObjectDynamic.ts +++ b/test/generated/output/assert/test_assert_ObjectDynamic.ts @@ -11,7 +11,7 @@ export const test_assert_ObjectDynamic = _test_assert( Object.keys(input).every((key: any) => { const value = input[key]; if (undefined === value) return true; - if (RegExp(/(.*)/).test(key)) + if (true) return ( "string" === typeof value || ("number" === typeof value && @@ -44,7 +44,7 @@ export const test_assert_ObjectDynamic = _test_assert( Object.keys(input).every((key: any) => { const value = input[key]; if (undefined === value) return true; - if (RegExp(/(.*)/).test(key)) + if (true) return ( "string" === typeof value || ("number" === typeof value && diff --git a/test/generated/output/assert/test_assert_UltimateUnion.ts b/test/generated/output/assert/test_assert_UltimateUnion.ts index d4fac8ae91..c99fc34e04 100644 --- a/test/generated/output/assert/test_assert_UltimateUnion.ts +++ b/test/generated/output/assert/test_assert_UltimateUnion.ts @@ -513,7 +513,7 @@ export const test_assert_UltimateUnion = _test_assert( Object.keys(input).every((key: any) => { const value = input[key]; if (undefined === value) return true; - if (RegExp(/(.*)/).test(key)) + if (true) return ( "object" === typeof value && null !== value && @@ -575,7 +575,7 @@ export const test_assert_UltimateUnion = _test_assert( Object.keys(input).every((key: any) => { const value = input[key]; if (undefined === value) return true; - if (RegExp(/(.*)/).test(key)) + if (true) return ( "object" === typeof value && null !== value && @@ -3311,7 +3311,7 @@ export const test_assert_UltimateUnion = _test_assert( Object.keys(input).every((key: any) => { const value = input[key]; if (undefined === value) return true; - if (RegExp(/(.*)/).test(key)) + if (true) return ( ((("object" === typeof value && null !== value && @@ -3557,7 +3557,7 @@ export const test_assert_UltimateUnion = _test_assert( Object.keys(input).every((key: any) => { const value = input[key]; if (undefined === value) return true; - if (RegExp(/(.*)/).test(key)) + if (true) return ( ((("object" === typeof value && null !== value && diff --git a/test/generated/output/assertEquals/test_assertEquals_DynamicComposite.ts b/test/generated/output/assertEquals/test_assertEquals_DynamicComposite.ts index 89451c92d0..585294331d 100644 --- a/test/generated/output/assertEquals/test_assertEquals_DynamicComposite.ts +++ b/test/generated/output/assertEquals/test_assertEquals_DynamicComposite.ts @@ -23,20 +23,26 @@ export const test_assertEquals_DynamicComposite = _test_assertEquals( const value = input[key]; if (undefined === value) return true; if ( - RegExp(/^[+-]?\d+(?:\.\d+)?(?:[eE][+-]?\d+)?$/).test( - key, - ) + "number" === typeof Number(key) && + Number.isFinite(Number(key)) ) return ( "number" === typeof value && Number.isFinite(value) ); - if (RegExp(/^(prefix_(.*))/).test(key)) + if ( + "string" === typeof key && + RegExp(/^prefix_(.*)/).test(key) + ) return "string" === typeof value; - if (RegExp(/((.*)_postfix)$/).test(key)) + if ( + "string" === typeof key && + RegExp(/(.*)_postfix$/).test(key) + ) return "string" === typeof value; if ( + "string" === typeof key && RegExp( - /^(value_[+-]?\d+(?:\.\d+)?(?:[eE][+-]?\d+)?)$/, + /^value_[+-]?\d+(?:\.\d+)?(?:[eE][+-]?\d+)?$/, ).test(key) ) return ( @@ -46,8 +52,9 @@ export const test_assertEquals_DynamicComposite = _test_assertEquals( "boolean" === typeof value ); if ( + "string" === typeof key && RegExp( - /^(between_(.*)_and_[+-]?\d+(?:\.\d+)?(?:[eE][+-]?\d+)?)$/, + /^between_(.*)_and_[+-]?\d+(?:\.\d+)?(?:[eE][+-]?\d+)?$/, ).test(key) ) return "boolean" === typeof value; @@ -91,9 +98,8 @@ export const test_assertEquals_DynamicComposite = _test_assertEquals( const value = input[key]; if (undefined === value) return true; if ( - RegExp( - /^[+-]?\d+(?:\.\d+)?(?:[eE][+-]?\d+)?$/, - ).test(key) + "number" === typeof Number(key) && + Number.isFinite(Number(key)) ) return ( ("number" === typeof value && @@ -104,7 +110,10 @@ export const test_assertEquals_DynamicComposite = _test_assertEquals( value: value, }) ); - if (RegExp(/^(prefix_(.*))/).test(key)) + if ( + "string" === typeof key && + RegExp(/^prefix_(.*)/).test(key) + ) return ( "string" === typeof value || $guard(_exceptionable, { @@ -113,7 +122,10 @@ export const test_assertEquals_DynamicComposite = _test_assertEquals( value: value, }) ); - if (RegExp(/((.*)_postfix)$/).test(key)) + if ( + "string" === typeof key && + RegExp(/(.*)_postfix$/).test(key) + ) return ( "string" === typeof value || $guard(_exceptionable, { @@ -123,8 +135,9 @@ export const test_assertEquals_DynamicComposite = _test_assertEquals( }) ); if ( + "string" === typeof key && RegExp( - /^(value_[+-]?\d+(?:\.\d+)?(?:[eE][+-]?\d+)?)$/, + /^value_[+-]?\d+(?:\.\d+)?(?:[eE][+-]?\d+)?$/, ).test(key) ) return ( @@ -139,8 +152,9 @@ export const test_assertEquals_DynamicComposite = _test_assertEquals( }) ); if ( + "string" === typeof key && RegExp( - /^(between_(.*)_and_[+-]?\d+(?:\.\d+)?(?:[eE][+-]?\d+)?)$/, + /^between_(.*)_and_[+-]?\d+(?:\.\d+)?(?:[eE][+-]?\d+)?$/, ).test(key) ) return ( diff --git a/test/generated/output/assertEquals/test_assertEquals_DynamicTag.ts b/test/generated/output/assertEquals/test_assertEquals_DynamicTag.ts new file mode 100644 index 0000000000..81fdc91c91 --- /dev/null +++ b/test/generated/output/assertEquals/test_assertEquals_DynamicTag.ts @@ -0,0 +1,132 @@ +import typia from "../../../../src"; +import { _test_assertEquals } from "../../../internal/_test_assertEquals"; +import { DynamicTag } from "../../../structures/DynamicTag"; + +export const test_assertEquals_DynamicTag = _test_assertEquals( + "DynamicTag", +)(DynamicTag)((input) => + ((input: any): DynamicTag => { + const __is = ( + input: any, + _exceptionable: boolean = true, + ): input is DynamicTag => { + const $join = (typia.assertEquals as any).join; + const $io0 = ( + input: any, + _exceptionable: boolean = true, + ): boolean => + Object.keys(input).every((key: any) => { + const value = input[key]; + if (undefined === value) return true; + if ( + "number" === typeof Number(key) && + 0 <= Number(key) && + Number(key) < 10 + ) + return "bigint" === typeof value && BigInt(0) <= value; + if ( + "string" === typeof key && + /^(?:[0-9a-f]{8}-[0-9a-f]{4}-[1-5][0-9a-f]{3}-[89ab][0-9a-f]{3}-[0-9a-f]{12}|00000000-0000-0000-0000-000000000000)$/i.test( + key, + ) + ) + return ( + "string" === typeof value && + /^(([^<>()[\]\.,;:\s@\"]+(\.[^<>()[\]\.,;:\s@\"]+)*)|(\".+\"))@(([^<>()[\]\.,;:\s@\"]+\.)+[^<>()[\]\.,;:\s@\"]{2,})$/i.test( + value, + ) + ); + return false; + }); + return ( + "object" === typeof input && + null !== input && + false === Array.isArray(input) && + $io0(input, true) + ); + }; + if (false === __is(input)) + (( + input: any, + _path: string, + _exceptionable: boolean = true, + ): input is DynamicTag => { + const $guard = (typia.assertEquals as any).guard; + const $join = (typia.assertEquals as any).join; + const $ao0 = ( + input: any, + _path: string, + _exceptionable: boolean = true, + ): boolean => + false === _exceptionable || + Object.keys(input).every((key: any) => { + const value = input[key]; + if (undefined === value) return true; + if ( + "number" === typeof Number(key) && + 0 <= Number(key) && + Number(key) < 10 + ) + return ( + ("bigint" === typeof value && + (BigInt(0) <= value || + $guard(_exceptionable, { + path: _path + $join(key), + expected: 'bigint & Type<"uint64">', + value: value, + }))) || + $guard(_exceptionable, { + path: _path + $join(key), + expected: '(bigint & Type<"uint64">)', + value: value, + }) + ); + if ( + "string" === typeof key && + /^(?:[0-9a-f]{8}-[0-9a-f]{4}-[1-5][0-9a-f]{3}-[89ab][0-9a-f]{3}-[0-9a-f]{12}|00000000-0000-0000-0000-000000000000)$/i.test( + key, + ) + ) + return ( + ("string" === typeof value && + (/^(([^<>()[\]\.,;:\s@\"]+(\.[^<>()[\]\.,;:\s@\"]+)*)|(\".+\"))@(([^<>()[\]\.,;:\s@\"]+\.)+[^<>()[\]\.,;:\s@\"]{2,})$/i.test( + value, + ) || + $guard(_exceptionable, { + path: _path + $join(key), + expected: + 'string & Format<"email">', + value: value, + }))) || + $guard(_exceptionable, { + path: _path + $join(key), + expected: '(string & Format<"email">)', + value: value, + }) + ); + return $guard(_exceptionable, { + path: _path + $join(key), + expected: "undefined", + value: value, + }); + }); + return ( + ((("object" === typeof input && + null !== input && + false === Array.isArray(input)) || + $guard(true, { + path: _path + "", + expected: "DynamicTag", + value: input, + })) && + $ao0(input, _path + "", true)) || + $guard(true, { + path: _path + "", + expected: "DynamicTag", + value: input, + }) + ); + })(input, "$input", true); + return input; + })(input), +); diff --git a/test/generated/output/assertEquals/test_assertEquals_DynamicTemplate.ts b/test/generated/output/assertEquals/test_assertEquals_DynamicTemplate.ts index fb94b6c964..cc24818138 100644 --- a/test/generated/output/assertEquals/test_assertEquals_DynamicTemplate.ts +++ b/test/generated/output/assertEquals/test_assertEquals_DynamicTemplate.ts @@ -18,21 +18,29 @@ export const test_assertEquals_DynamicTemplate = _test_assertEquals( Object.keys(input).every((key: any) => { const value = input[key]; if (undefined === value) return true; - if (RegExp(/^(prefix_(.*))/).test(key)) + if ( + "string" === typeof key && + RegExp(/^prefix_(.*)/).test(key) + ) return "string" === typeof value; - if (RegExp(/((.*)_postfix)$/).test(key)) + if ( + "string" === typeof key && + RegExp(/(.*)_postfix$/).test(key) + ) return "string" === typeof value; if ( + "string" === typeof key && RegExp( - /^(value_[+-]?\d+(?:\.\d+)?(?:[eE][+-]?\d+)?)$/, + /^value_[+-]?\d+(?:\.\d+)?(?:[eE][+-]?\d+)?$/, ).test(key) ) return ( "number" === typeof value && Number.isFinite(value) ); if ( + "string" === typeof key && RegExp( - /^(between_(.*)_and_[+-]?\d+(?:\.\d+)?(?:[eE][+-]?\d+)?)$/, + /^between_(.*)_and_[+-]?\d+(?:\.\d+)?(?:[eE][+-]?\d+)?$/, ).test(key) ) return "boolean" === typeof value; @@ -62,7 +70,10 @@ export const test_assertEquals_DynamicTemplate = _test_assertEquals( Object.keys(input).every((key: any) => { const value = input[key]; if (undefined === value) return true; - if (RegExp(/^(prefix_(.*))/).test(key)) + if ( + "string" === typeof key && + RegExp(/^prefix_(.*)/).test(key) + ) return ( "string" === typeof value || $guard(_exceptionable, { @@ -71,7 +82,10 @@ export const test_assertEquals_DynamicTemplate = _test_assertEquals( value: value, }) ); - if (RegExp(/((.*)_postfix)$/).test(key)) + if ( + "string" === typeof key && + RegExp(/(.*)_postfix$/).test(key) + ) return ( "string" === typeof value || $guard(_exceptionable, { @@ -81,8 +95,9 @@ export const test_assertEquals_DynamicTemplate = _test_assertEquals( }) ); if ( + "string" === typeof key && RegExp( - /^(value_[+-]?\d+(?:\.\d+)?(?:[eE][+-]?\d+)?)$/, + /^value_[+-]?\d+(?:\.\d+)?(?:[eE][+-]?\d+)?$/, ).test(key) ) return ( @@ -95,8 +110,9 @@ export const test_assertEquals_DynamicTemplate = _test_assertEquals( }) ); if ( + "string" === typeof key && RegExp( - /^(between_(.*)_and_[+-]?\d+(?:\.\d+)?(?:[eE][+-]?\d+)?)$/, + /^between_(.*)_and_[+-]?\d+(?:\.\d+)?(?:[eE][+-]?\d+)?$/, ).test(key) ) return ( diff --git a/test/generated/output/assertEquals/test_assertEquals_DynamicUnion.ts b/test/generated/output/assertEquals/test_assertEquals_DynamicUnion.ts index 6b91afad77..8eacd94f95 100644 --- a/test/generated/output/assertEquals/test_assertEquals_DynamicUnion.ts +++ b/test/generated/output/assertEquals/test_assertEquals_DynamicUnion.ts @@ -19,18 +19,24 @@ export const test_assertEquals_DynamicUnion = _test_assertEquals( const value = input[key]; if (undefined === value) return true; if ( - RegExp(/^[+-]?\d+(?:\.\d+)?(?:[eE][+-]?\d+)?$/).test( - key, - ) + "number" === typeof Number(key) && + Number.isFinite(Number(key)) ) return "string" === typeof value; - if (RegExp(/^(prefix_(.*))/).test(key)) + if ( + "string" === typeof key && + RegExp(/^prefix_(.*)/).test(key) + ) return "string" === typeof value; - if (RegExp(/((.*)_postfix)$/).test(key)) + if ( + "string" === typeof key && + RegExp(/(.*)_postfix$/).test(key) + ) return "string" === typeof value; if ( + "string" === typeof key && RegExp( - /^(value_between_[+-]?\d+(?:\.\d+)?(?:[eE][+-]?\d+)?_and_[+-]?\d+(?:\.\d+)?(?:[eE][+-]?\d+)?)$/, + /^value_between_[+-]?\d+(?:\.\d+)?(?:[eE][+-]?\d+)?_and_[+-]?\d+(?:\.\d+)?(?:[eE][+-]?\d+)?$/, ).test(key) ) return ( @@ -63,9 +69,8 @@ export const test_assertEquals_DynamicUnion = _test_assertEquals( const value = input[key]; if (undefined === value) return true; if ( - RegExp( - /^[+-]?\d+(?:\.\d+)?(?:[eE][+-]?\d+)?$/, - ).test(key) + "number" === typeof Number(key) && + Number.isFinite(Number(key)) ) return ( "string" === typeof value || @@ -75,7 +80,10 @@ export const test_assertEquals_DynamicUnion = _test_assertEquals( value: value, }) ); - if (RegExp(/^(prefix_(.*))/).test(key)) + if ( + "string" === typeof key && + RegExp(/^prefix_(.*)/).test(key) + ) return ( "string" === typeof value || $guard(_exceptionable, { @@ -84,7 +92,10 @@ export const test_assertEquals_DynamicUnion = _test_assertEquals( value: value, }) ); - if (RegExp(/((.*)_postfix)$/).test(key)) + if ( + "string" === typeof key && + RegExp(/(.*)_postfix$/).test(key) + ) return ( "string" === typeof value || $guard(_exceptionable, { @@ -94,8 +105,9 @@ export const test_assertEquals_DynamicUnion = _test_assertEquals( }) ); if ( + "string" === typeof key && RegExp( - /^(value_between_[+-]?\d+(?:\.\d+)?(?:[eE][+-]?\d+)?_and_[+-]?\d+(?:\.\d+)?(?:[eE][+-]?\d+)?)$/, + /^value_between_[+-]?\d+(?:\.\d+)?(?:[eE][+-]?\d+)?_and_[+-]?\d+(?:\.\d+)?(?:[eE][+-]?\d+)?$/, ).test(key) ) return ( diff --git a/test/generated/output/createAssert/test_createAssert_DynamicArray.ts b/test/generated/output/createAssert/test_createAssert_DynamicArray.ts index 17a8d32945..2ffbcd7bc8 100644 --- a/test/generated/output/createAssert/test_createAssert_DynamicArray.ts +++ b/test/generated/output/createAssert/test_createAssert_DynamicArray.ts @@ -15,7 +15,7 @@ export const test_createAssert_DynamicArray = _test_assert( Object.keys(input).every((key: any) => { const value = input[key]; if (undefined === value) return true; - if (RegExp(/(.*)/).test(key)) + if (true) return ( Array.isArray(value) && value.every((elem: any) => "string" === typeof elem) @@ -64,7 +64,7 @@ export const test_createAssert_DynamicArray = _test_assert( Object.keys(input).every((key: any) => { const value = input[key]; if (undefined === value) return true; - if (RegExp(/(.*)/).test(key)) + if (true) return ( ((Array.isArray(value) || $guard(_exceptionable, { diff --git a/test/generated/output/createAssert/test_createAssert_DynamicComposite.ts b/test/generated/output/createAssert/test_createAssert_DynamicComposite.ts index a07486b099..64faf83d9d 100644 --- a/test/generated/output/createAssert/test_createAssert_DynamicComposite.ts +++ b/test/generated/output/createAssert/test_createAssert_DynamicComposite.ts @@ -14,16 +14,23 @@ export const test_createAssert_DynamicComposite = _test_assert( return true; const value = input[key]; if (undefined === value) return true; - if (RegExp(/^[+-]?\d+(?:\.\d+)?(?:[eE][+-]?\d+)?$/).test(key)) + if ( + "number" === typeof Number(key) && + Number.isFinite(Number(key)) + ) return "number" === typeof value && Number.isFinite(value); - if (RegExp(/^(prefix_(.*))/).test(key)) + if ("string" === typeof key && RegExp(/^prefix_(.*)/).test(key)) return "string" === typeof value; - if (RegExp(/((.*)_postfix)$/).test(key)) + if ( + "string" === typeof key && + RegExp(/(.*)_postfix$/).test(key) + ) return "string" === typeof value; if ( - RegExp( - /^(value_[+-]?\d+(?:\.\d+)?(?:[eE][+-]?\d+)?)$/, - ).test(key) + "string" === typeof key && + RegExp(/^value_[+-]?\d+(?:\.\d+)?(?:[eE][+-]?\d+)?$/).test( + key, + ) ) return ( "string" === typeof value || @@ -31,8 +38,9 @@ export const test_createAssert_DynamicComposite = _test_assert( "boolean" === typeof value ); if ( + "string" === typeof key && RegExp( - /^(between_(.*)_and_[+-]?\d+(?:\.\d+)?(?:[eE][+-]?\d+)?)$/, + /^between_(.*)_and_[+-]?\d+(?:\.\d+)?(?:[eE][+-]?\d+)?$/, ).test(key) ) return "boolean" === typeof value; @@ -72,9 +80,8 @@ export const test_createAssert_DynamicComposite = _test_assert( const value = input[key]; if (undefined === value) return true; if ( - RegExp( - /^[+-]?\d+(?:\.\d+)?(?:[eE][+-]?\d+)?$/, - ).test(key) + "number" === typeof Number(key) && + Number.isFinite(Number(key)) ) return ( ("number" === typeof value && @@ -85,7 +92,10 @@ export const test_createAssert_DynamicComposite = _test_assert( value: value, }) ); - if (RegExp(/^(prefix_(.*))/).test(key)) + if ( + "string" === typeof key && + RegExp(/^prefix_(.*)/).test(key) + ) return ( "string" === typeof value || $guard(_exceptionable, { @@ -94,7 +104,10 @@ export const test_createAssert_DynamicComposite = _test_assert( value: value, }) ); - if (RegExp(/((.*)_postfix)$/).test(key)) + if ( + "string" === typeof key && + RegExp(/(.*)_postfix$/).test(key) + ) return ( "string" === typeof value || $guard(_exceptionable, { @@ -104,8 +117,9 @@ export const test_createAssert_DynamicComposite = _test_assert( }) ); if ( + "string" === typeof key && RegExp( - /^(value_[+-]?\d+(?:\.\d+)?(?:[eE][+-]?\d+)?)$/, + /^value_[+-]?\d+(?:\.\d+)?(?:[eE][+-]?\d+)?$/, ).test(key) ) return ( @@ -120,8 +134,9 @@ export const test_createAssert_DynamicComposite = _test_assert( }) ); if ( + "string" === typeof key && RegExp( - /^(between_(.*)_and_[+-]?\d+(?:\.\d+)?(?:[eE][+-]?\d+)?)$/, + /^between_(.*)_and_[+-]?\d+(?:\.\d+)?(?:[eE][+-]?\d+)?$/, ).test(key) ) return ( diff --git a/test/generated/output/createAssert/test_createAssert_DynamicJsonValue.ts b/test/generated/output/createAssert/test_createAssert_DynamicJsonValue.ts index 8f43d549e8..9807a5789b 100644 --- a/test/generated/output/createAssert/test_createAssert_DynamicJsonValue.ts +++ b/test/generated/output/createAssert/test_createAssert_DynamicJsonValue.ts @@ -10,7 +10,7 @@ export const test_createAssert_DynamicJsonValue = _test_assert( Object.keys(input).every((key: any) => { const value = input[key]; if (undefined === value) return true; - if (RegExp(/(.*)/).test(key)) + if (true) return ( null === value || undefined === value || @@ -69,7 +69,7 @@ export const test_createAssert_DynamicJsonValue = _test_assert( Object.keys(input).every((key: any) => { const value = input[key]; if (undefined === value) return true; - if (RegExp(/(.*)/).test(key)) + if (true) return ( null === value || undefined === value || diff --git a/test/generated/output/createAssert/test_createAssert_DynamicNever.ts b/test/generated/output/createAssert/test_createAssert_DynamicNever.ts index 6aa7a78550..642a903bd8 100644 --- a/test/generated/output/createAssert/test_createAssert_DynamicNever.ts +++ b/test/generated/output/createAssert/test_createAssert_DynamicNever.ts @@ -10,8 +10,7 @@ export const test_createAssert_DynamicNever = _test_assert( Object.keys(input).every((key: any) => { const value = input[key]; if (undefined === value) return true; - if (RegExp(/(.*)/).test(key)) - return null !== value && undefined === value; + if (true) return null !== value && undefined === value; return true; }); return ( @@ -38,7 +37,7 @@ export const test_createAssert_DynamicNever = _test_assert( Object.keys(input).every((key: any) => { const value = input[key]; if (undefined === value) return true; - if (RegExp(/(.*)/).test(key)) + if (true) return ( (null !== value || $guard(_exceptionable, { diff --git a/test/generated/output/createAssert/test_createAssert_DynamicSimple.ts b/test/generated/output/createAssert/test_createAssert_DynamicSimple.ts index fa32b8f731..e93d91ce04 100644 --- a/test/generated/output/createAssert/test_createAssert_DynamicSimple.ts +++ b/test/generated/output/createAssert/test_createAssert_DynamicSimple.ts @@ -15,7 +15,7 @@ export const test_createAssert_DynamicSimple = _test_assert( Object.keys(input).every((key: any) => { const value = input[key]; if (undefined === value) return true; - if (RegExp(/(.*)/).test(key)) + if (true) return "number" === typeof value && Number.isFinite(value); return true; }); @@ -61,7 +61,7 @@ export const test_createAssert_DynamicSimple = _test_assert( Object.keys(input).every((key: any) => { const value = input[key]; if (undefined === value) return true; - if (RegExp(/(.*)/).test(key)) + if (true) return ( ("number" === typeof value && Number.isFinite(value)) || diff --git a/test/generated/output/createAssert/test_createAssert_DynamicTag.ts b/test/generated/output/createAssert/test_createAssert_DynamicTag.ts new file mode 100644 index 0000000000..50c19183d7 --- /dev/null +++ b/test/generated/output/createAssert/test_createAssert_DynamicTag.ts @@ -0,0 +1,118 @@ +import typia from "../../../../src"; +import { _test_assert } from "../../../internal/_test_assert"; +import { DynamicTag } from "../../../structures/DynamicTag"; + +export const test_createAssert_DynamicTag = _test_assert( + "DynamicTag", +)(DynamicTag)((input: any): DynamicTag => { + const __is = (input: any): input is DynamicTag => { + const $io0 = (input: any): boolean => + Object.keys(input).every((key: any) => { + const value = input[key]; + if (undefined === value) return true; + if ( + "number" === typeof Number(key) && + 0 <= Number(key) && + Number(key) < 10 + ) + return "bigint" === typeof value && BigInt(0) <= value; + if ( + "string" === typeof key && + /^(?:[0-9a-f]{8}-[0-9a-f]{4}-[1-5][0-9a-f]{3}-[89ab][0-9a-f]{3}-[0-9a-f]{12}|00000000-0000-0000-0000-000000000000)$/i.test( + key, + ) + ) + return ( + "string" === typeof value && + /^(([^<>()[\]\.,;:\s@\"]+(\.[^<>()[\]\.,;:\s@\"]+)*)|(\".+\"))@(([^<>()[\]\.,;:\s@\"]+\.)+[^<>()[\]\.,;:\s@\"]{2,})$/i.test( + value, + ) + ); + return true; + }); + return ( + "object" === typeof input && + null !== input && + false === Array.isArray(input) && + $io0(input) + ); + }; + if (false === __is(input)) + (( + input: any, + _path: string, + _exceptionable: boolean = true, + ): input is DynamicTag => { + const $guard = (typia.createAssert as any).guard; + const $join = (typia.createAssert as any).join; + const $ao0 = ( + input: any, + _path: string, + _exceptionable: boolean = true, + ): boolean => + false === _exceptionable || + Object.keys(input).every((key: any) => { + const value = input[key]; + if (undefined === value) return true; + if ( + "number" === typeof Number(key) && + 0 <= Number(key) && + Number(key) < 10 + ) + return ( + ("bigint" === typeof value && + (BigInt(0) <= value || + $guard(_exceptionable, { + path: _path + $join(key), + expected: 'bigint & Type<"uint64">', + value: value, + }))) || + $guard(_exceptionable, { + path: _path + $join(key), + expected: '(bigint & Type<"uint64">)', + value: value, + }) + ); + if ( + "string" === typeof key && + /^(?:[0-9a-f]{8}-[0-9a-f]{4}-[1-5][0-9a-f]{3}-[89ab][0-9a-f]{3}-[0-9a-f]{12}|00000000-0000-0000-0000-000000000000)$/i.test( + key, + ) + ) + return ( + ("string" === typeof value && + (/^(([^<>()[\]\.,;:\s@\"]+(\.[^<>()[\]\.,;:\s@\"]+)*)|(\".+\"))@(([^<>()[\]\.,;:\s@\"]+\.)+[^<>()[\]\.,;:\s@\"]{2,})$/i.test( + value, + ) || + $guard(_exceptionable, { + path: _path + $join(key), + expected: 'string & Format<"email">', + value: value, + }))) || + $guard(_exceptionable, { + path: _path + $join(key), + expected: '(string & Format<"email">)', + value: value, + }) + ); + return true; + }); + return ( + ((("object" === typeof input && + null !== input && + false === Array.isArray(input)) || + $guard(true, { + path: _path + "", + expected: "DynamicTag", + value: input, + })) && + $ao0(input, _path + "", true)) || + $guard(true, { + path: _path + "", + expected: "DynamicTag", + value: input, + }) + ); + })(input, "$input", true); + return input; +}); diff --git a/test/generated/output/createAssert/test_createAssert_DynamicTemplate.ts b/test/generated/output/createAssert/test_createAssert_DynamicTemplate.ts index c16aab0c1c..ea893da6da 100644 --- a/test/generated/output/createAssert/test_createAssert_DynamicTemplate.ts +++ b/test/generated/output/createAssert/test_createAssert_DynamicTemplate.ts @@ -10,19 +10,24 @@ export const test_createAssert_DynamicTemplate = _test_assert( Object.keys(input).every((key: any) => { const value = input[key]; if (undefined === value) return true; - if (RegExp(/^(prefix_(.*))/).test(key)) + if ("string" === typeof key && RegExp(/^prefix_(.*)/).test(key)) return "string" === typeof value; - if (RegExp(/((.*)_postfix)$/).test(key)) + if ( + "string" === typeof key && + RegExp(/(.*)_postfix$/).test(key) + ) return "string" === typeof value; if ( - RegExp( - /^(value_[+-]?\d+(?:\.\d+)?(?:[eE][+-]?\d+)?)$/, - ).test(key) + "string" === typeof key && + RegExp(/^value_[+-]?\d+(?:\.\d+)?(?:[eE][+-]?\d+)?$/).test( + key, + ) ) return "number" === typeof value && Number.isFinite(value); if ( + "string" === typeof key && RegExp( - /^(between_(.*)_and_[+-]?\d+(?:\.\d+)?(?:[eE][+-]?\d+)?)$/, + /^between_(.*)_and_[+-]?\d+(?:\.\d+)?(?:[eE][+-]?\d+)?$/, ).test(key) ) return "boolean" === typeof value; @@ -52,7 +57,10 @@ export const test_createAssert_DynamicTemplate = _test_assert( Object.keys(input).every((key: any) => { const value = input[key]; if (undefined === value) return true; - if (RegExp(/^(prefix_(.*))/).test(key)) + if ( + "string" === typeof key && + RegExp(/^prefix_(.*)/).test(key) + ) return ( "string" === typeof value || $guard(_exceptionable, { @@ -61,7 +69,10 @@ export const test_createAssert_DynamicTemplate = _test_assert( value: value, }) ); - if (RegExp(/((.*)_postfix)$/).test(key)) + if ( + "string" === typeof key && + RegExp(/(.*)_postfix$/).test(key) + ) return ( "string" === typeof value || $guard(_exceptionable, { @@ -71,8 +82,9 @@ export const test_createAssert_DynamicTemplate = _test_assert( }) ); if ( + "string" === typeof key && RegExp( - /^(value_[+-]?\d+(?:\.\d+)?(?:[eE][+-]?\d+)?)$/, + /^value_[+-]?\d+(?:\.\d+)?(?:[eE][+-]?\d+)?$/, ).test(key) ) return ( @@ -85,8 +97,9 @@ export const test_createAssert_DynamicTemplate = _test_assert( }) ); if ( + "string" === typeof key && RegExp( - /^(between_(.*)_and_[+-]?\d+(?:\.\d+)?(?:[eE][+-]?\d+)?)$/, + /^between_(.*)_and_[+-]?\d+(?:\.\d+)?(?:[eE][+-]?\d+)?$/, ).test(key) ) return ( diff --git a/test/generated/output/createAssert/test_createAssert_DynamicTree.ts b/test/generated/output/createAssert/test_createAssert_DynamicTree.ts index 4612556b86..531bd3faa6 100644 --- a/test/generated/output/createAssert/test_createAssert_DynamicTree.ts +++ b/test/generated/output/createAssert/test_createAssert_DynamicTree.ts @@ -18,7 +18,7 @@ export const test_createAssert_DynamicTree = _test_assert( Object.keys(input).every((key: any) => { const value = input[key]; if (undefined === value) return true; - if (RegExp(/(.*)/).test(key)) + if (true) return ( "object" === typeof value && null !== value && @@ -81,7 +81,7 @@ export const test_createAssert_DynamicTree = _test_assert( Object.keys(input).every((key: any) => { const value = input[key]; if (undefined === value) return true; - if (RegExp(/(.*)/).test(key)) + if (true) return ( ((("object" === typeof value && null !== value) || $guard(_exceptionable, { diff --git a/test/generated/output/createAssert/test_createAssert_DynamicUndefined.ts b/test/generated/output/createAssert/test_createAssert_DynamicUndefined.ts index 3cb39d3a08..a17c93dafd 100644 --- a/test/generated/output/createAssert/test_createAssert_DynamicUndefined.ts +++ b/test/generated/output/createAssert/test_createAssert_DynamicUndefined.ts @@ -10,8 +10,7 @@ export const test_createAssert_DynamicUndefined = _test_assert( Object.keys(input).every((key: any) => { const value = input[key]; if (undefined === value) return true; - if (RegExp(/(.*)/).test(key)) - return null !== value && undefined === value; + if (true) return null !== value && undefined === value; return true; }); return ( @@ -38,7 +37,7 @@ export const test_createAssert_DynamicUndefined = _test_assert( Object.keys(input).every((key: any) => { const value = input[key]; if (undefined === value) return true; - if (RegExp(/(.*)/).test(key)) + if (true) return ( (null !== value || $guard(_exceptionable, { diff --git a/test/generated/output/createAssert/test_createAssert_DynamicUnion.ts b/test/generated/output/createAssert/test_createAssert_DynamicUnion.ts index 043a7e6c4c..44b0592e3c 100644 --- a/test/generated/output/createAssert/test_createAssert_DynamicUnion.ts +++ b/test/generated/output/createAssert/test_createAssert_DynamicUnion.ts @@ -10,15 +10,22 @@ export const test_createAssert_DynamicUnion = _test_assert( Object.keys(input).every((key: any) => { const value = input[key]; if (undefined === value) return true; - if (RegExp(/^[+-]?\d+(?:\.\d+)?(?:[eE][+-]?\d+)?$/).test(key)) + if ( + "number" === typeof Number(key) && + Number.isFinite(Number(key)) + ) return "string" === typeof value; - if (RegExp(/^(prefix_(.*))/).test(key)) + if ("string" === typeof key && RegExp(/^prefix_(.*)/).test(key)) return "string" === typeof value; - if (RegExp(/((.*)_postfix)$/).test(key)) + if ( + "string" === typeof key && + RegExp(/(.*)_postfix$/).test(key) + ) return "string" === typeof value; if ( + "string" === typeof key && RegExp( - /^(value_between_[+-]?\d+(?:\.\d+)?(?:[eE][+-]?\d+)?_and_[+-]?\d+(?:\.\d+)?(?:[eE][+-]?\d+)?)$/, + /^value_between_[+-]?\d+(?:\.\d+)?(?:[eE][+-]?\d+)?_and_[+-]?\d+(?:\.\d+)?(?:[eE][+-]?\d+)?$/, ).test(key) ) return "number" === typeof value && Number.isFinite(value); @@ -49,9 +56,8 @@ export const test_createAssert_DynamicUnion = _test_assert( const value = input[key]; if (undefined === value) return true; if ( - RegExp(/^[+-]?\d+(?:\.\d+)?(?:[eE][+-]?\d+)?$/).test( - key, - ) + "number" === typeof Number(key) && + Number.isFinite(Number(key)) ) return ( "string" === typeof value || @@ -61,7 +67,10 @@ export const test_createAssert_DynamicUnion = _test_assert( value: value, }) ); - if (RegExp(/^(prefix_(.*))/).test(key)) + if ( + "string" === typeof key && + RegExp(/^prefix_(.*)/).test(key) + ) return ( "string" === typeof value || $guard(_exceptionable, { @@ -70,7 +79,10 @@ export const test_createAssert_DynamicUnion = _test_assert( value: value, }) ); - if (RegExp(/((.*)_postfix)$/).test(key)) + if ( + "string" === typeof key && + RegExp(/(.*)_postfix$/).test(key) + ) return ( "string" === typeof value || $guard(_exceptionable, { @@ -80,8 +92,9 @@ export const test_createAssert_DynamicUnion = _test_assert( }) ); if ( + "string" === typeof key && RegExp( - /^(value_between_[+-]?\d+(?:\.\d+)?(?:[eE][+-]?\d+)?_and_[+-]?\d+(?:\.\d+)?(?:[eE][+-]?\d+)?)$/, + /^value_between_[+-]?\d+(?:\.\d+)?(?:[eE][+-]?\d+)?_and_[+-]?\d+(?:\.\d+)?(?:[eE][+-]?\d+)?$/, ).test(key) ) return ( diff --git a/test/generated/output/createAssert/test_createAssert_ObjectDynamic.ts b/test/generated/output/createAssert/test_createAssert_ObjectDynamic.ts index c1fe6a6646..482dbcc34c 100644 --- a/test/generated/output/createAssert/test_createAssert_ObjectDynamic.ts +++ b/test/generated/output/createAssert/test_createAssert_ObjectDynamic.ts @@ -10,7 +10,7 @@ export const test_createAssert_ObjectDynamic = _test_assert( Object.keys(input).every((key: any) => { const value = input[key]; if (undefined === value) return true; - if (RegExp(/(.*)/).test(key)) + if (true) return ( "string" === typeof value || ("number" === typeof value && Number.isFinite(value)) || @@ -42,7 +42,7 @@ export const test_createAssert_ObjectDynamic = _test_assert( Object.keys(input).every((key: any) => { const value = input[key]; if (undefined === value) return true; - if (RegExp(/(.*)/).test(key)) + if (true) return ( "string" === typeof value || ("number" === typeof value && diff --git a/test/generated/output/createAssert/test_createAssert_UltimateUnion.ts b/test/generated/output/createAssert/test_createAssert_UltimateUnion.ts index ba5fa4cf36..c81d68bb01 100644 --- a/test/generated/output/createAssert/test_createAssert_UltimateUnion.ts +++ b/test/generated/output/createAssert/test_createAssert_UltimateUnion.ts @@ -497,7 +497,7 @@ export const test_createAssert_UltimateUnion = _test_assert( Object.keys(input).every((key: any) => { const value = input[key]; if (undefined === value) return true; - if (RegExp(/(.*)/).test(key)) + if (true) return ( "object" === typeof value && null !== value && @@ -556,7 +556,7 @@ export const test_createAssert_UltimateUnion = _test_assert( Object.keys(input).every((key: any) => { const value = input[key]; if (undefined === value) return true; - if (RegExp(/(.*)/).test(key)) + if (true) return ( "object" === typeof value && null !== value && @@ -3243,7 +3243,7 @@ export const test_createAssert_UltimateUnion = _test_assert( Object.keys(input).every((key: any) => { const value = input[key]; if (undefined === value) return true; - if (RegExp(/(.*)/).test(key)) + if (true) return ( ((("object" === typeof value && null !== value && @@ -3479,7 +3479,7 @@ export const test_createAssert_UltimateUnion = _test_assert( Object.keys(input).every((key: any) => { const value = input[key]; if (undefined === value) return true; - if (RegExp(/(.*)/).test(key)) + if (true) return ( ((("object" === typeof value && null !== value && diff --git a/test/generated/output/createAssertEquals/test_createAssertEquals_DynamicComposite.ts b/test/generated/output/createAssertEquals/test_createAssertEquals_DynamicComposite.ts index df9046fe54..c41a17d611 100644 --- a/test/generated/output/createAssertEquals/test_createAssertEquals_DynamicComposite.ts +++ b/test/generated/output/createAssertEquals/test_createAssertEquals_DynamicComposite.ts @@ -18,16 +18,23 @@ export const test_createAssertEquals_DynamicComposite = _test_assertEquals( return true; const value = input[key]; if (undefined === value) return true; - if (RegExp(/^[+-]?\d+(?:\.\d+)?(?:[eE][+-]?\d+)?$/).test(key)) + if ( + "number" === typeof Number(key) && + Number.isFinite(Number(key)) + ) return "number" === typeof value && Number.isFinite(value); - if (RegExp(/^(prefix_(.*))/).test(key)) + if ("string" === typeof key && RegExp(/^prefix_(.*)/).test(key)) return "string" === typeof value; - if (RegExp(/((.*)_postfix)$/).test(key)) + if ( + "string" === typeof key && + RegExp(/(.*)_postfix$/).test(key) + ) return "string" === typeof value; if ( - RegExp( - /^(value_[+-]?\d+(?:\.\d+)?(?:[eE][+-]?\d+)?)$/, - ).test(key) + "string" === typeof key && + RegExp(/^value_[+-]?\d+(?:\.\d+)?(?:[eE][+-]?\d+)?$/).test( + key, + ) ) return ( "string" === typeof value || @@ -35,8 +42,9 @@ export const test_createAssertEquals_DynamicComposite = _test_assertEquals( "boolean" === typeof value ); if ( + "string" === typeof key && RegExp( - /^(between_(.*)_and_[+-]?\d+(?:\.\d+)?(?:[eE][+-]?\d+)?)$/, + /^between_(.*)_and_[+-]?\d+(?:\.\d+)?(?:[eE][+-]?\d+)?$/, ).test(key) ) return "boolean" === typeof value; @@ -76,9 +84,8 @@ export const test_createAssertEquals_DynamicComposite = _test_assertEquals( const value = input[key]; if (undefined === value) return true; if ( - RegExp( - /^[+-]?\d+(?:\.\d+)?(?:[eE][+-]?\d+)?$/, - ).test(key) + "number" === typeof Number(key) && + Number.isFinite(Number(key)) ) return ( ("number" === typeof value && @@ -89,7 +96,10 @@ export const test_createAssertEquals_DynamicComposite = _test_assertEquals( value: value, }) ); - if (RegExp(/^(prefix_(.*))/).test(key)) + if ( + "string" === typeof key && + RegExp(/^prefix_(.*)/).test(key) + ) return ( "string" === typeof value || $guard(_exceptionable, { @@ -98,7 +108,10 @@ export const test_createAssertEquals_DynamicComposite = _test_assertEquals( value: value, }) ); - if (RegExp(/((.*)_postfix)$/).test(key)) + if ( + "string" === typeof key && + RegExp(/(.*)_postfix$/).test(key) + ) return ( "string" === typeof value || $guard(_exceptionable, { @@ -108,8 +121,9 @@ export const test_createAssertEquals_DynamicComposite = _test_assertEquals( }) ); if ( + "string" === typeof key && RegExp( - /^(value_[+-]?\d+(?:\.\d+)?(?:[eE][+-]?\d+)?)$/, + /^value_[+-]?\d+(?:\.\d+)?(?:[eE][+-]?\d+)?$/, ).test(key) ) return ( @@ -124,8 +138,9 @@ export const test_createAssertEquals_DynamicComposite = _test_assertEquals( }) ); if ( + "string" === typeof key && RegExp( - /^(between_(.*)_and_[+-]?\d+(?:\.\d+)?(?:[eE][+-]?\d+)?)$/, + /^between_(.*)_and_[+-]?\d+(?:\.\d+)?(?:[eE][+-]?\d+)?$/, ).test(key) ) return ( diff --git a/test/generated/output/createAssertEquals/test_createAssertEquals_DynamicTag.ts b/test/generated/output/createAssertEquals/test_createAssertEquals_DynamicTag.ts new file mode 100644 index 0000000000..0b86c6d7fc --- /dev/null +++ b/test/generated/output/createAssertEquals/test_createAssertEquals_DynamicTag.ts @@ -0,0 +1,126 @@ +import typia from "../../../../src"; +import { _test_assertEquals } from "../../../internal/_test_assertEquals"; +import { DynamicTag } from "../../../structures/DynamicTag"; + +export const test_createAssertEquals_DynamicTag = _test_assertEquals( + "DynamicTag", +)(DynamicTag)((input: any): DynamicTag => { + const __is = ( + input: any, + _exceptionable: boolean = true, + ): input is DynamicTag => { + const $join = (typia.createAssertEquals as any).join; + const $io0 = (input: any, _exceptionable: boolean = true): boolean => + Object.keys(input).every((key: any) => { + const value = input[key]; + if (undefined === value) return true; + if ( + "number" === typeof Number(key) && + 0 <= Number(key) && + Number(key) < 10 + ) + return "bigint" === typeof value && BigInt(0) <= value; + if ( + "string" === typeof key && + /^(?:[0-9a-f]{8}-[0-9a-f]{4}-[1-5][0-9a-f]{3}-[89ab][0-9a-f]{3}-[0-9a-f]{12}|00000000-0000-0000-0000-000000000000)$/i.test( + key, + ) + ) + return ( + "string" === typeof value && + /^(([^<>()[\]\.,;:\s@\"]+(\.[^<>()[\]\.,;:\s@\"]+)*)|(\".+\"))@(([^<>()[\]\.,;:\s@\"]+\.)+[^<>()[\]\.,;:\s@\"]{2,})$/i.test( + value, + ) + ); + return false; + }); + return ( + "object" === typeof input && + null !== input && + false === Array.isArray(input) && + $io0(input, true) + ); + }; + if (false === __is(input)) + (( + input: any, + _path: string, + _exceptionable: boolean = true, + ): input is DynamicTag => { + const $guard = (typia.createAssertEquals as any).guard; + const $join = (typia.createAssertEquals as any).join; + const $ao0 = ( + input: any, + _path: string, + _exceptionable: boolean = true, + ): boolean => + false === _exceptionable || + Object.keys(input).every((key: any) => { + const value = input[key]; + if (undefined === value) return true; + if ( + "number" === typeof Number(key) && + 0 <= Number(key) && + Number(key) < 10 + ) + return ( + ("bigint" === typeof value && + (BigInt(0) <= value || + $guard(_exceptionable, { + path: _path + $join(key), + expected: 'bigint & Type<"uint64">', + value: value, + }))) || + $guard(_exceptionable, { + path: _path + $join(key), + expected: '(bigint & Type<"uint64">)', + value: value, + }) + ); + if ( + "string" === typeof key && + /^(?:[0-9a-f]{8}-[0-9a-f]{4}-[1-5][0-9a-f]{3}-[89ab][0-9a-f]{3}-[0-9a-f]{12}|00000000-0000-0000-0000-000000000000)$/i.test( + key, + ) + ) + return ( + ("string" === typeof value && + (/^(([^<>()[\]\.,;:\s@\"]+(\.[^<>()[\]\.,;:\s@\"]+)*)|(\".+\"))@(([^<>()[\]\.,;:\s@\"]+\.)+[^<>()[\]\.,;:\s@\"]{2,})$/i.test( + value, + ) || + $guard(_exceptionable, { + path: _path + $join(key), + expected: 'string & Format<"email">', + value: value, + }))) || + $guard(_exceptionable, { + path: _path + $join(key), + expected: '(string & Format<"email">)', + value: value, + }) + ); + return $guard(_exceptionable, { + path: _path + $join(key), + expected: "undefined", + value: value, + }); + }); + return ( + ((("object" === typeof input && + null !== input && + false === Array.isArray(input)) || + $guard(true, { + path: _path + "", + expected: "DynamicTag", + value: input, + })) && + $ao0(input, _path + "", true)) || + $guard(true, { + path: _path + "", + expected: "DynamicTag", + value: input, + }) + ); + })(input, "$input", true); + return input; +}); diff --git a/test/generated/output/createAssertEquals/test_createAssertEquals_DynamicTemplate.ts b/test/generated/output/createAssertEquals/test_createAssertEquals_DynamicTemplate.ts index 1262ea0f25..7d61632aaf 100644 --- a/test/generated/output/createAssertEquals/test_createAssertEquals_DynamicTemplate.ts +++ b/test/generated/output/createAssertEquals/test_createAssertEquals_DynamicTemplate.ts @@ -14,19 +14,24 @@ export const test_createAssertEquals_DynamicTemplate = _test_assertEquals( Object.keys(input).every((key: any) => { const value = input[key]; if (undefined === value) return true; - if (RegExp(/^(prefix_(.*))/).test(key)) + if ("string" === typeof key && RegExp(/^prefix_(.*)/).test(key)) return "string" === typeof value; - if (RegExp(/((.*)_postfix)$/).test(key)) + if ( + "string" === typeof key && + RegExp(/(.*)_postfix$/).test(key) + ) return "string" === typeof value; if ( - RegExp( - /^(value_[+-]?\d+(?:\.\d+)?(?:[eE][+-]?\d+)?)$/, - ).test(key) + "string" === typeof key && + RegExp(/^value_[+-]?\d+(?:\.\d+)?(?:[eE][+-]?\d+)?$/).test( + key, + ) ) return "number" === typeof value && Number.isFinite(value); if ( + "string" === typeof key && RegExp( - /^(between_(.*)_and_[+-]?\d+(?:\.\d+)?(?:[eE][+-]?\d+)?)$/, + /^between_(.*)_and_[+-]?\d+(?:\.\d+)?(?:[eE][+-]?\d+)?$/, ).test(key) ) return "boolean" === typeof value; @@ -56,7 +61,10 @@ export const test_createAssertEquals_DynamicTemplate = _test_assertEquals( Object.keys(input).every((key: any) => { const value = input[key]; if (undefined === value) return true; - if (RegExp(/^(prefix_(.*))/).test(key)) + if ( + "string" === typeof key && + RegExp(/^prefix_(.*)/).test(key) + ) return ( "string" === typeof value || $guard(_exceptionable, { @@ -65,7 +73,10 @@ export const test_createAssertEquals_DynamicTemplate = _test_assertEquals( value: value, }) ); - if (RegExp(/((.*)_postfix)$/).test(key)) + if ( + "string" === typeof key && + RegExp(/(.*)_postfix$/).test(key) + ) return ( "string" === typeof value || $guard(_exceptionable, { @@ -75,8 +86,9 @@ export const test_createAssertEquals_DynamicTemplate = _test_assertEquals( }) ); if ( + "string" === typeof key && RegExp( - /^(value_[+-]?\d+(?:\.\d+)?(?:[eE][+-]?\d+)?)$/, + /^value_[+-]?\d+(?:\.\d+)?(?:[eE][+-]?\d+)?$/, ).test(key) ) return ( @@ -89,8 +101,9 @@ export const test_createAssertEquals_DynamicTemplate = _test_assertEquals( }) ); if ( + "string" === typeof key && RegExp( - /^(between_(.*)_and_[+-]?\d+(?:\.\d+)?(?:[eE][+-]?\d+)?)$/, + /^between_(.*)_and_[+-]?\d+(?:\.\d+)?(?:[eE][+-]?\d+)?$/, ).test(key) ) return ( diff --git a/test/generated/output/createAssertEquals/test_createAssertEquals_DynamicUnion.ts b/test/generated/output/createAssertEquals/test_createAssertEquals_DynamicUnion.ts index dd49b28784..2f049177da 100644 --- a/test/generated/output/createAssertEquals/test_createAssertEquals_DynamicUnion.ts +++ b/test/generated/output/createAssertEquals/test_createAssertEquals_DynamicUnion.ts @@ -14,15 +14,22 @@ export const test_createAssertEquals_DynamicUnion = _test_assertEquals( Object.keys(input).every((key: any) => { const value = input[key]; if (undefined === value) return true; - if (RegExp(/^[+-]?\d+(?:\.\d+)?(?:[eE][+-]?\d+)?$/).test(key)) + if ( + "number" === typeof Number(key) && + Number.isFinite(Number(key)) + ) return "string" === typeof value; - if (RegExp(/^(prefix_(.*))/).test(key)) + if ("string" === typeof key && RegExp(/^prefix_(.*)/).test(key)) return "string" === typeof value; - if (RegExp(/((.*)_postfix)$/).test(key)) + if ( + "string" === typeof key && + RegExp(/(.*)_postfix$/).test(key) + ) return "string" === typeof value; if ( + "string" === typeof key && RegExp( - /^(value_between_[+-]?\d+(?:\.\d+)?(?:[eE][+-]?\d+)?_and_[+-]?\d+(?:\.\d+)?(?:[eE][+-]?\d+)?)$/, + /^value_between_[+-]?\d+(?:\.\d+)?(?:[eE][+-]?\d+)?_and_[+-]?\d+(?:\.\d+)?(?:[eE][+-]?\d+)?$/, ).test(key) ) return "number" === typeof value && Number.isFinite(value); @@ -53,9 +60,8 @@ export const test_createAssertEquals_DynamicUnion = _test_assertEquals( const value = input[key]; if (undefined === value) return true; if ( - RegExp(/^[+-]?\d+(?:\.\d+)?(?:[eE][+-]?\d+)?$/).test( - key, - ) + "number" === typeof Number(key) && + Number.isFinite(Number(key)) ) return ( "string" === typeof value || @@ -65,7 +71,10 @@ export const test_createAssertEquals_DynamicUnion = _test_assertEquals( value: value, }) ); - if (RegExp(/^(prefix_(.*))/).test(key)) + if ( + "string" === typeof key && + RegExp(/^prefix_(.*)/).test(key) + ) return ( "string" === typeof value || $guard(_exceptionable, { @@ -74,7 +83,10 @@ export const test_createAssertEquals_DynamicUnion = _test_assertEquals( value: value, }) ); - if (RegExp(/((.*)_postfix)$/).test(key)) + if ( + "string" === typeof key && + RegExp(/(.*)_postfix$/).test(key) + ) return ( "string" === typeof value || $guard(_exceptionable, { @@ -84,8 +96,9 @@ export const test_createAssertEquals_DynamicUnion = _test_assertEquals( }) ); if ( + "string" === typeof key && RegExp( - /^(value_between_[+-]?\d+(?:\.\d+)?(?:[eE][+-]?\d+)?_and_[+-]?\d+(?:\.\d+)?(?:[eE][+-]?\d+)?)$/, + /^value_between_[+-]?\d+(?:\.\d+)?(?:[eE][+-]?\d+)?_and_[+-]?\d+(?:\.\d+)?(?:[eE][+-]?\d+)?$/, ).test(key) ) return ( diff --git a/test/generated/output/createEquals/test_createEquals_DynamicComposite.ts b/test/generated/output/createEquals/test_createEquals_DynamicComposite.ts index fa8d45ae2e..f5a17fcf92 100644 --- a/test/generated/output/createEquals/test_createEquals_DynamicComposite.ts +++ b/test/generated/output/createEquals/test_createEquals_DynamicComposite.ts @@ -15,16 +15,23 @@ export const test_createEquals_DynamicComposite = _test_equals( return true; const value = input[key]; if (undefined === value) return true; - if (RegExp(/^[+-]?\d+(?:\.\d+)?(?:[eE][+-]?\d+)?$/).test(key)) + if ( + "number" === typeof Number(key) && + Number.isFinite(Number(key)) + ) return "number" === typeof value && Number.isFinite(value); - if (RegExp(/^(prefix_(.*))/).test(key)) + if ("string" === typeof key && RegExp(/^prefix_(.*)/).test(key)) return "string" === typeof value; - if (RegExp(/((.*)_postfix)$/).test(key)) + if ( + "string" === typeof key && + RegExp(/(.*)_postfix$/).test(key) + ) return "string" === typeof value; if ( - RegExp( - /^(value_[+-]?\d+(?:\.\d+)?(?:[eE][+-]?\d+)?)$/, - ).test(key) + "string" === typeof key && + RegExp(/^value_[+-]?\d+(?:\.\d+)?(?:[eE][+-]?\d+)?$/).test( + key, + ) ) return ( "string" === typeof value || @@ -32,8 +39,9 @@ export const test_createEquals_DynamicComposite = _test_equals( "boolean" === typeof value ); if ( + "string" === typeof key && RegExp( - /^(between_(.*)_and_[+-]?\d+(?:\.\d+)?(?:[eE][+-]?\d+)?)$/, + /^between_(.*)_and_[+-]?\d+(?:\.\d+)?(?:[eE][+-]?\d+)?$/, ).test(key) ) return "boolean" === typeof value; diff --git a/test/generated/output/createEquals/test_createEquals_DynamicTag.ts b/test/generated/output/createEquals/test_createEquals_DynamicTag.ts new file mode 100644 index 0000000000..7702474c7f --- /dev/null +++ b/test/generated/output/createEquals/test_createEquals_DynamicTag.ts @@ -0,0 +1,41 @@ +import typia from "../../../../src"; +import { _test_equals } from "../../../internal/_test_equals"; +import { DynamicTag } from "../../../structures/DynamicTag"; + +export const test_createEquals_DynamicTag = _test_equals( + "DynamicTag", +)(DynamicTag)( + (input: any, _exceptionable: boolean = true): input is DynamicTag => { + const $join = (typia.createEquals as any).join; + const $io0 = (input: any, _exceptionable: boolean = true): boolean => + Object.keys(input).every((key: any) => { + const value = input[key]; + if (undefined === value) return true; + if ( + "number" === typeof Number(key) && + 0 <= Number(key) && + Number(key) < 10 + ) + return "bigint" === typeof value && BigInt(0) <= value; + if ( + "string" === typeof key && + /^(?:[0-9a-f]{8}-[0-9a-f]{4}-[1-5][0-9a-f]{3}-[89ab][0-9a-f]{3}-[0-9a-f]{12}|00000000-0000-0000-0000-000000000000)$/i.test( + key, + ) + ) + return ( + "string" === typeof value && + /^(([^<>()[\]\.,;:\s@\"]+(\.[^<>()[\]\.,;:\s@\"]+)*)|(\".+\"))@(([^<>()[\]\.,;:\s@\"]+\.)+[^<>()[\]\.,;:\s@\"]{2,})$/i.test( + value, + ) + ); + return false; + }); + return ( + "object" === typeof input && + null !== input && + false === Array.isArray(input) && + $io0(input, true) + ); + }, +); diff --git a/test/generated/output/createEquals/test_createEquals_DynamicTemplate.ts b/test/generated/output/createEquals/test_createEquals_DynamicTemplate.ts index dd52822f58..a56355c509 100644 --- a/test/generated/output/createEquals/test_createEquals_DynamicTemplate.ts +++ b/test/generated/output/createEquals/test_createEquals_DynamicTemplate.ts @@ -11,19 +11,24 @@ export const test_createEquals_DynamicTemplate = _test_equals( Object.keys(input).every((key: any) => { const value = input[key]; if (undefined === value) return true; - if (RegExp(/^(prefix_(.*))/).test(key)) + if ("string" === typeof key && RegExp(/^prefix_(.*)/).test(key)) return "string" === typeof value; - if (RegExp(/((.*)_postfix)$/).test(key)) + if ( + "string" === typeof key && + RegExp(/(.*)_postfix$/).test(key) + ) return "string" === typeof value; if ( - RegExp( - /^(value_[+-]?\d+(?:\.\d+)?(?:[eE][+-]?\d+)?)$/, - ).test(key) + "string" === typeof key && + RegExp(/^value_[+-]?\d+(?:\.\d+)?(?:[eE][+-]?\d+)?$/).test( + key, + ) ) return "number" === typeof value && Number.isFinite(value); if ( + "string" === typeof key && RegExp( - /^(between_(.*)_and_[+-]?\d+(?:\.\d+)?(?:[eE][+-]?\d+)?)$/, + /^between_(.*)_and_[+-]?\d+(?:\.\d+)?(?:[eE][+-]?\d+)?$/, ).test(key) ) return "boolean" === typeof value; diff --git a/test/generated/output/createEquals/test_createEquals_DynamicUnion.ts b/test/generated/output/createEquals/test_createEquals_DynamicUnion.ts index 8411b8bc31..932cd2ce71 100644 --- a/test/generated/output/createEquals/test_createEquals_DynamicUnion.ts +++ b/test/generated/output/createEquals/test_createEquals_DynamicUnion.ts @@ -11,15 +11,22 @@ export const test_createEquals_DynamicUnion = _test_equals( Object.keys(input).every((key: any) => { const value = input[key]; if (undefined === value) return true; - if (RegExp(/^[+-]?\d+(?:\.\d+)?(?:[eE][+-]?\d+)?$/).test(key)) + if ( + "number" === typeof Number(key) && + Number.isFinite(Number(key)) + ) return "string" === typeof value; - if (RegExp(/^(prefix_(.*))/).test(key)) + if ("string" === typeof key && RegExp(/^prefix_(.*)/).test(key)) return "string" === typeof value; - if (RegExp(/((.*)_postfix)$/).test(key)) + if ( + "string" === typeof key && + RegExp(/(.*)_postfix$/).test(key) + ) return "string" === typeof value; if ( + "string" === typeof key && RegExp( - /^(value_between_[+-]?\d+(?:\.\d+)?(?:[eE][+-]?\d+)?_and_[+-]?\d+(?:\.\d+)?(?:[eE][+-]?\d+)?)$/, + /^value_between_[+-]?\d+(?:\.\d+)?(?:[eE][+-]?\d+)?_and_[+-]?\d+(?:\.\d+)?(?:[eE][+-]?\d+)?$/, ).test(key) ) return "number" === typeof value && Number.isFinite(value); diff --git a/test/generated/output/createIs/test_createIs_DynamicArray.ts b/test/generated/output/createIs/test_createIs_DynamicArray.ts index d46d68aa7f..0a6341178d 100644 --- a/test/generated/output/createIs/test_createIs_DynamicArray.ts +++ b/test/generated/output/createIs/test_createIs_DynamicArray.ts @@ -14,7 +14,7 @@ export const test_createIs_DynamicArray = _test_is( Object.keys(input).every((key: any) => { const value = input[key]; if (undefined === value) return true; - if (RegExp(/(.*)/).test(key)) + if (true) return ( Array.isArray(value) && value.every((elem: any) => "string" === typeof elem) diff --git a/test/generated/output/createIs/test_createIs_DynamicComposite.ts b/test/generated/output/createIs/test_createIs_DynamicComposite.ts index f6f9fc8a35..acfb2a6c1c 100644 --- a/test/generated/output/createIs/test_createIs_DynamicComposite.ts +++ b/test/generated/output/createIs/test_createIs_DynamicComposite.ts @@ -14,16 +14,23 @@ export const test_createIs_DynamicComposite = _test_is( return true; const value = input[key]; if (undefined === value) return true; - if (RegExp(/^[+-]?\d+(?:\.\d+)?(?:[eE][+-]?\d+)?$/).test(key)) + if ( + "number" === typeof Number(key) && + Number.isFinite(Number(key)) + ) return "number" === typeof value && Number.isFinite(value); - if (RegExp(/^(prefix_(.*))/).test(key)) + if ("string" === typeof key && RegExp(/^prefix_(.*)/).test(key)) return "string" === typeof value; - if (RegExp(/((.*)_postfix)$/).test(key)) + if ( + "string" === typeof key && + RegExp(/(.*)_postfix$/).test(key) + ) return "string" === typeof value; if ( - RegExp( - /^(value_[+-]?\d+(?:\.\d+)?(?:[eE][+-]?\d+)?)$/, - ).test(key) + "string" === typeof key && + RegExp(/^value_[+-]?\d+(?:\.\d+)?(?:[eE][+-]?\d+)?$/).test( + key, + ) ) return ( "string" === typeof value || @@ -31,8 +38,9 @@ export const test_createIs_DynamicComposite = _test_is( "boolean" === typeof value ); if ( + "string" === typeof key && RegExp( - /^(between_(.*)_and_[+-]?\d+(?:\.\d+)?(?:[eE][+-]?\d+)?)$/, + /^between_(.*)_and_[+-]?\d+(?:\.\d+)?(?:[eE][+-]?\d+)?$/, ).test(key) ) return "boolean" === typeof value; diff --git a/test/generated/output/createIs/test_createIs_DynamicJsonValue.ts b/test/generated/output/createIs/test_createIs_DynamicJsonValue.ts index 59d8910ad6..09bd8d69aa 100644 --- a/test/generated/output/createIs/test_createIs_DynamicJsonValue.ts +++ b/test/generated/output/createIs/test_createIs_DynamicJsonValue.ts @@ -10,7 +10,7 @@ export const test_createIs_DynamicJsonValue = _test_is( Object.keys(input).every((key: any) => { const value = input[key]; if (undefined === value) return true; - if (RegExp(/(.*)/).test(key)) + if (true) return ( null === value || undefined === value || diff --git a/test/generated/output/createIs/test_createIs_DynamicNever.ts b/test/generated/output/createIs/test_createIs_DynamicNever.ts index 903b01871d..baaca4c307 100644 --- a/test/generated/output/createIs/test_createIs_DynamicNever.ts +++ b/test/generated/output/createIs/test_createIs_DynamicNever.ts @@ -9,8 +9,7 @@ export const test_createIs_DynamicNever = _test_is( Object.keys(input).every((key: any) => { const value = input[key]; if (undefined === value) return true; - if (RegExp(/(.*)/).test(key)) - return null !== value && undefined === value; + if (true) return null !== value && undefined === value; return true; }); return ( diff --git a/test/generated/output/createIs/test_createIs_DynamicSimple.ts b/test/generated/output/createIs/test_createIs_DynamicSimple.ts index 7f55ad87fe..f10e23caf9 100644 --- a/test/generated/output/createIs/test_createIs_DynamicSimple.ts +++ b/test/generated/output/createIs/test_createIs_DynamicSimple.ts @@ -14,7 +14,7 @@ export const test_createIs_DynamicSimple = _test_is( Object.keys(input).every((key: any) => { const value = input[key]; if (undefined === value) return true; - if (RegExp(/(.*)/).test(key)) + if (true) return "number" === typeof value && Number.isFinite(value); return true; }); diff --git a/test/generated/output/createIs/test_createIs_DynamicTag.ts b/test/generated/output/createIs/test_createIs_DynamicTag.ts new file mode 100644 index 0000000000..8764162fb1 --- /dev/null +++ b/test/generated/output/createIs/test_createIs_DynamicTag.ts @@ -0,0 +1,38 @@ +import typia from "../../../../src"; +import { _test_is } from "../../../internal/_test_is"; +import { DynamicTag } from "../../../structures/DynamicTag"; + +export const test_createIs_DynamicTag = _test_is("DynamicTag")( + DynamicTag, +)((input: any): input is DynamicTag => { + const $io0 = (input: any): boolean => + Object.keys(input).every((key: any) => { + const value = input[key]; + if (undefined === value) return true; + if ( + "number" === typeof Number(key) && + 0 <= Number(key) && + Number(key) < 10 + ) + return "bigint" === typeof value && BigInt(0) <= value; + if ( + "string" === typeof key && + /^(?:[0-9a-f]{8}-[0-9a-f]{4}-[1-5][0-9a-f]{3}-[89ab][0-9a-f]{3}-[0-9a-f]{12}|00000000-0000-0000-0000-000000000000)$/i.test( + key, + ) + ) + return ( + "string" === typeof value && + /^(([^<>()[\]\.,;:\s@\"]+(\.[^<>()[\]\.,;:\s@\"]+)*)|(\".+\"))@(([^<>()[\]\.,;:\s@\"]+\.)+[^<>()[\]\.,;:\s@\"]{2,})$/i.test( + value, + ) + ); + return true; + }); + return ( + "object" === typeof input && + null !== input && + false === Array.isArray(input) && + $io0(input) + ); +}); diff --git a/test/generated/output/createIs/test_createIs_DynamicTemplate.ts b/test/generated/output/createIs/test_createIs_DynamicTemplate.ts index e05d32bc06..09e5ce0c14 100644 --- a/test/generated/output/createIs/test_createIs_DynamicTemplate.ts +++ b/test/generated/output/createIs/test_createIs_DynamicTemplate.ts @@ -9,19 +9,19 @@ export const test_createIs_DynamicTemplate = _test_is( Object.keys(input).every((key: any) => { const value = input[key]; if (undefined === value) return true; - if (RegExp(/^(prefix_(.*))/).test(key)) + if ("string" === typeof key && RegExp(/^prefix_(.*)/).test(key)) return "string" === typeof value; - if (RegExp(/((.*)_postfix)$/).test(key)) + if ("string" === typeof key && RegExp(/(.*)_postfix$/).test(key)) return "string" === typeof value; if ( - RegExp(/^(value_[+-]?\d+(?:\.\d+)?(?:[eE][+-]?\d+)?)$/).test( - key, - ) + "string" === typeof key && + RegExp(/^value_[+-]?\d+(?:\.\d+)?(?:[eE][+-]?\d+)?$/).test(key) ) return "number" === typeof value && Number.isFinite(value); if ( + "string" === typeof key && RegExp( - /^(between_(.*)_and_[+-]?\d+(?:\.\d+)?(?:[eE][+-]?\d+)?)$/, + /^between_(.*)_and_[+-]?\d+(?:\.\d+)?(?:[eE][+-]?\d+)?$/, ).test(key) ) return "boolean" === typeof value; diff --git a/test/generated/output/createIs/test_createIs_DynamicTree.ts b/test/generated/output/createIs/test_createIs_DynamicTree.ts index 4c841fcca1..273262fd89 100644 --- a/test/generated/output/createIs/test_createIs_DynamicTree.ts +++ b/test/generated/output/createIs/test_createIs_DynamicTree.ts @@ -17,7 +17,7 @@ export const test_createIs_DynamicTree = _test_is("DynamicTree")( Object.keys(input).every((key: any) => { const value = input[key]; if (undefined === value) return true; - if (RegExp(/(.*)/).test(key)) + if (true) return ( "object" === typeof value && null !== value && $io0(value) ); diff --git a/test/generated/output/createIs/test_createIs_DynamicUndefined.ts b/test/generated/output/createIs/test_createIs_DynamicUndefined.ts index c823de81bf..e447057690 100644 --- a/test/generated/output/createIs/test_createIs_DynamicUndefined.ts +++ b/test/generated/output/createIs/test_createIs_DynamicUndefined.ts @@ -10,8 +10,7 @@ export const test_createIs_DynamicUndefined = _test_is( Object.keys(input).every((key: any) => { const value = input[key]; if (undefined === value) return true; - if (RegExp(/(.*)/).test(key)) - return null !== value && undefined === value; + if (true) return null !== value && undefined === value; return true; }); return ( diff --git a/test/generated/output/createIs/test_createIs_DynamicUnion.ts b/test/generated/output/createIs/test_createIs_DynamicUnion.ts index 72fa566d32..08121f0c47 100644 --- a/test/generated/output/createIs/test_createIs_DynamicUnion.ts +++ b/test/generated/output/createIs/test_createIs_DynamicUnion.ts @@ -9,15 +9,16 @@ export const test_createIs_DynamicUnion = _test_is( Object.keys(input).every((key: any) => { const value = input[key]; if (undefined === value) return true; - if (RegExp(/^[+-]?\d+(?:\.\d+)?(?:[eE][+-]?\d+)?$/).test(key)) + if ("number" === typeof Number(key) && Number.isFinite(Number(key))) return "string" === typeof value; - if (RegExp(/^(prefix_(.*))/).test(key)) + if ("string" === typeof key && RegExp(/^prefix_(.*)/).test(key)) return "string" === typeof value; - if (RegExp(/((.*)_postfix)$/).test(key)) + if ("string" === typeof key && RegExp(/(.*)_postfix$/).test(key)) return "string" === typeof value; if ( + "string" === typeof key && RegExp( - /^(value_between_[+-]?\d+(?:\.\d+)?(?:[eE][+-]?\d+)?_and_[+-]?\d+(?:\.\d+)?(?:[eE][+-]?\d+)?)$/, + /^value_between_[+-]?\d+(?:\.\d+)?(?:[eE][+-]?\d+)?_and_[+-]?\d+(?:\.\d+)?(?:[eE][+-]?\d+)?$/, ).test(key) ) return "number" === typeof value && Number.isFinite(value); diff --git a/test/generated/output/createIs/test_createIs_ObjectDynamic.ts b/test/generated/output/createIs/test_createIs_ObjectDynamic.ts index d995aed648..18f7e1cfd7 100644 --- a/test/generated/output/createIs/test_createIs_ObjectDynamic.ts +++ b/test/generated/output/createIs/test_createIs_ObjectDynamic.ts @@ -9,7 +9,7 @@ export const test_createIs_ObjectDynamic = _test_is( Object.keys(input).every((key: any) => { const value = input[key]; if (undefined === value) return true; - if (RegExp(/(.*)/).test(key)) + if (true) return ( "string" === typeof value || ("number" === typeof value && Number.isFinite(value)) || diff --git a/test/generated/output/createIs/test_createIs_UltimateUnion.ts b/test/generated/output/createIs/test_createIs_UltimateUnion.ts index d45df53560..54bea23258 100644 --- a/test/generated/output/createIs/test_createIs_UltimateUnion.ts +++ b/test/generated/output/createIs/test_createIs_UltimateUnion.ts @@ -448,7 +448,7 @@ export const test_createIs_UltimateUnion = _test_is( Object.keys(input).every((key: any) => { const value = input[key]; if (undefined === value) return true; - if (RegExp(/(.*)/).test(key)) + if (true) return ( "object" === typeof value && null !== value && @@ -503,7 +503,7 @@ export const test_createIs_UltimateUnion = _test_is( Object.keys(input).every((key: any) => { const value = input[key]; if (undefined === value) return true; - if (RegExp(/(.*)/).test(key)) + if (true) return ( "object" === typeof value && null !== value && diff --git a/test/generated/output/createRandom/test_createRandom_DynamicArray.ts b/test/generated/output/createRandom/test_createRandom_DynamicArray.ts index fb85150a6b..a7e6089b92 100644 --- a/test/generated/output/createRandom/test_createRandom_DynamicArray.ts +++ b/test/generated/output/createRandom/test_createRandom_DynamicArray.ts @@ -48,7 +48,7 @@ export const test_createRandom_DynamicArray = _test_random( Object.keys(input).every((key: any) => { const value = input[key]; if (undefined === value) return true; - if (RegExp(/(.*)/).test(key)) + if (true) return ( Array.isArray(value) && value.every((elem: any) => "string" === typeof elem) @@ -97,7 +97,7 @@ export const test_createRandom_DynamicArray = _test_random( Object.keys(input).every((key: any) => { const value = input[key]; if (undefined === value) return true; - if (RegExp(/(.*)/).test(key)) + if (true) return ( ((Array.isArray(value) || $guard(_exceptionable, { diff --git a/test/generated/output/createRandom/test_createRandom_DynamicComposite.ts b/test/generated/output/createRandom/test_createRandom_DynamicComposite.ts index c2b33a68b6..27d514910f 100644 --- a/test/generated/output/createRandom/test_createRandom_DynamicComposite.ts +++ b/test/generated/output/createRandom/test_createRandom_DynamicComposite.ts @@ -118,20 +118,26 @@ export const test_createRandom_DynamicComposite = _test_random( const value = input[key]; if (undefined === value) return true; if ( - RegExp(/^[+-]?\d+(?:\.\d+)?(?:[eE][+-]?\d+)?$/).test( - key, - ) + "number" === typeof Number(key) && + Number.isFinite(Number(key)) ) return ( "number" === typeof value && Number.isFinite(value) ); - if (RegExp(/^(prefix_(.*))/).test(key)) + if ( + "string" === typeof key && + RegExp(/^prefix_(.*)/).test(key) + ) return "string" === typeof value; - if (RegExp(/((.*)_postfix)$/).test(key)) + if ( + "string" === typeof key && + RegExp(/(.*)_postfix$/).test(key) + ) return "string" === typeof value; if ( + "string" === typeof key && RegExp( - /^(value_[+-]?\d+(?:\.\d+)?(?:[eE][+-]?\d+)?)$/, + /^value_[+-]?\d+(?:\.\d+)?(?:[eE][+-]?\d+)?$/, ).test(key) ) return ( @@ -141,8 +147,9 @@ export const test_createRandom_DynamicComposite = _test_random( "boolean" === typeof value ); if ( + "string" === typeof key && RegExp( - /^(between_(.*)_and_[+-]?\d+(?:\.\d+)?(?:[eE][+-]?\d+)?)$/, + /^between_(.*)_and_[+-]?\d+(?:\.\d+)?(?:[eE][+-]?\d+)?$/, ).test(key) ) return "boolean" === typeof value; @@ -184,9 +191,8 @@ export const test_createRandom_DynamicComposite = _test_random( const value = input[key]; if (undefined === value) return true; if ( - RegExp( - /^[+-]?\d+(?:\.\d+)?(?:[eE][+-]?\d+)?$/, - ).test(key) + "number" === typeof Number(key) && + Number.isFinite(Number(key)) ) return ( ("number" === typeof value && @@ -197,7 +203,10 @@ export const test_createRandom_DynamicComposite = _test_random( value: value, }) ); - if (RegExp(/^(prefix_(.*))/).test(key)) + if ( + "string" === typeof key && + RegExp(/^prefix_(.*)/).test(key) + ) return ( "string" === typeof value || $guard(_exceptionable, { @@ -206,7 +215,10 @@ export const test_createRandom_DynamicComposite = _test_random( value: value, }) ); - if (RegExp(/((.*)_postfix)$/).test(key)) + if ( + "string" === typeof key && + RegExp(/(.*)_postfix$/).test(key) + ) return ( "string" === typeof value || $guard(_exceptionable, { @@ -216,8 +228,9 @@ export const test_createRandom_DynamicComposite = _test_random( }) ); if ( + "string" === typeof key && RegExp( - /^(value_[+-]?\d+(?:\.\d+)?(?:[eE][+-]?\d+)?)$/, + /^value_[+-]?\d+(?:\.\d+)?(?:[eE][+-]?\d+)?$/, ).test(key) ) return ( @@ -232,8 +245,9 @@ export const test_createRandom_DynamicComposite = _test_random( }) ); if ( + "string" === typeof key && RegExp( - /^(between_(.*)_and_[+-]?\d+(?:\.\d+)?(?:[eE][+-]?\d+)?)$/, + /^between_(.*)_and_[+-]?\d+(?:\.\d+)?(?:[eE][+-]?\d+)?$/, ).test(key) ) return ( diff --git a/test/generated/output/createRandom/test_createRandom_DynamicJsonValue.ts b/test/generated/output/createRandom/test_createRandom_DynamicJsonValue.ts index 05d180b372..9cac864bd0 100644 --- a/test/generated/output/createRandom/test_createRandom_DynamicJsonValue.ts +++ b/test/generated/output/createRandom/test_createRandom_DynamicJsonValue.ts @@ -107,7 +107,7 @@ export const test_createRandom_DynamicJsonValue = _test_random( Object.keys(input).every((key: any) => { const value = input[key]; if (undefined === value) return true; - if (RegExp(/(.*)/).test(key)) + if (true) return ( null === value || undefined === value || @@ -168,7 +168,7 @@ export const test_createRandom_DynamicJsonValue = _test_random( Object.keys(input).every((key: any) => { const value = input[key]; if (undefined === value) return true; - if (RegExp(/(.*)/).test(key)) + if (true) return ( null === value || undefined === value || diff --git a/test/generated/output/createRandom/test_createRandom_DynamicNever.ts b/test/generated/output/createRandom/test_createRandom_DynamicNever.ts index 3be5a8f0ec..118eedae27 100644 --- a/test/generated/output/createRandom/test_createRandom_DynamicNever.ts +++ b/test/generated/output/createRandom/test_createRandom_DynamicNever.ts @@ -31,8 +31,7 @@ export const test_createRandom_DynamicNever = _test_random( Object.keys(input).every((key: any) => { const value = input[key]; if (undefined === value) return true; - if (RegExp(/(.*)/).test(key)) - return null !== value && undefined === value; + if (true) return null !== value && undefined === value; return true; }); return ( @@ -59,7 +58,7 @@ export const test_createRandom_DynamicNever = _test_random( Object.keys(input).every((key: any) => { const value = input[key]; if (undefined === value) return true; - if (RegExp(/(.*)/).test(key)) + if (true) return ( (null !== value || $guard(_exceptionable, { diff --git a/test/generated/output/createRandom/test_createRandom_DynamicSimple.ts b/test/generated/output/createRandom/test_createRandom_DynamicSimple.ts index 28da2a8d0e..6e508c1eb9 100644 --- a/test/generated/output/createRandom/test_createRandom_DynamicSimple.ts +++ b/test/generated/output/createRandom/test_createRandom_DynamicSimple.ts @@ -45,7 +45,7 @@ export const test_createRandom_DynamicSimple = _test_random( Object.keys(input).every((key: any) => { const value = input[key]; if (undefined === value) return true; - if (RegExp(/(.*)/).test(key)) + if (true) return ( "number" === typeof value && Number.isFinite(value) ); @@ -93,7 +93,7 @@ export const test_createRandom_DynamicSimple = _test_random( Object.keys(input).every((key: any) => { const value = input[key]; if (undefined === value) return true; - if (RegExp(/(.*)/).test(key)) + if (true) return ( ("number" === typeof value && Number.isFinite(value)) || diff --git a/test/generated/output/createRandom/test_createRandom_DynamicTag.ts b/test/generated/output/createRandom/test_createRandom_DynamicTag.ts new file mode 100644 index 0000000000..29126c91ca --- /dev/null +++ b/test/generated/output/createRandom/test_createRandom_DynamicTag.ts @@ -0,0 +1,180 @@ +import typia from "../../../../src"; +import { _test_random } from "../../../internal/_test_random"; +import { DynamicTag } from "../../../structures/DynamicTag"; + +export const test_createRandom_DynamicTag = _test_random( + "DynamicTag", +)(DynamicTag)({ + random: ( + generator: Partial = (DynamicTag as any).RANDOM, + ): typia.Resolved => { + const $generator = (typia.createRandom as any).generator; + const $ro0 = (_recursive: boolean = false, _depth: number = 0): any => { + const output = {} as any; + (generator?.array ?? $generator.array)( + () => + (output[ + (generator?.customs ?? $generator.customs)?.number?.([ + { + name: "Minimum<0>", + kind: "minimum", + value: 0, + }, + { + name: "ExclusiveMaximum<10>", + kind: "exclusiveMaximum", + value: 10, + }, + ]) ?? (generator?.number ?? $generator.number)(0, 10) + ] = + (generator?.customs ?? $generator.customs)?.bigint?.([ + { + name: 'Type<"uint64">', + kind: "type", + value: "uint64", + }, + ]) ?? + (generator?.bigint ?? $generator.bigint)( + BigInt(0), + BigInt(10), + )), + (generator?.integer ?? $generator.integer)(0, 3), + ); + (generator?.array ?? $generator.array)( + () => + (output[ + (generator?.customs ?? $generator.customs)?.string?.([ + { + name: 'Format<"uuid">', + kind: "format", + value: "uuid", + }, + ]) ?? (generator?.uuid ?? $generator.uuid)() + ] = + (generator?.customs ?? $generator.customs)?.string?.([ + { + name: 'Format<"email">', + kind: "format", + value: "email", + }, + ]) ?? (generator?.email ?? $generator.email)()), + (generator?.integer ?? $generator.integer)(0, 3), + ); + return output; + }; + return $ro0(); + }, + assert: (input: any): DynamicTag => { + const __is = (input: any): input is DynamicTag => { + const $io0 = (input: any): boolean => + Object.keys(input).every((key: any) => { + const value = input[key]; + if (undefined === value) return true; + if ( + "number" === typeof Number(key) && + 0 <= Number(key) && + Number(key) < 10 + ) + return "bigint" === typeof value && BigInt(0) <= value; + if ( + "string" === typeof key && + /^(?:[0-9a-f]{8}-[0-9a-f]{4}-[1-5][0-9a-f]{3}-[89ab][0-9a-f]{3}-[0-9a-f]{12}|00000000-0000-0000-0000-000000000000)$/i.test( + key, + ) + ) + return ( + "string" === typeof value && + /^(([^<>()[\]\.,;:\s@\"]+(\.[^<>()[\]\.,;:\s@\"]+)*)|(\".+\"))@(([^<>()[\]\.,;:\s@\"]+\.)+[^<>()[\]\.,;:\s@\"]{2,})$/i.test( + value, + ) + ); + return true; + }); + return ( + "object" === typeof input && + null !== input && + false === Array.isArray(input) && + $io0(input) + ); + }; + if (false === __is(input)) + (( + input: any, + _path: string, + _exceptionable: boolean = true, + ): input is DynamicTag => { + const $guard = (typia.createAssert as any).guard; + const $join = (typia.createAssert as any).join; + const $ao0 = ( + input: any, + _path: string, + _exceptionable: boolean = true, + ): boolean => + false === _exceptionable || + Object.keys(input).every((key: any) => { + const value = input[key]; + if (undefined === value) return true; + if ( + "number" === typeof Number(key) && + 0 <= Number(key) && + Number(key) < 10 + ) + return ( + ("bigint" === typeof value && + (BigInt(0) <= value || + $guard(_exceptionable, { + path: _path + $join(key), + expected: 'bigint & Type<"uint64">', + value: value, + }))) || + $guard(_exceptionable, { + path: _path + $join(key), + expected: '(bigint & Type<"uint64">)', + value: value, + }) + ); + if ( + "string" === typeof key && + /^(?:[0-9a-f]{8}-[0-9a-f]{4}-[1-5][0-9a-f]{3}-[89ab][0-9a-f]{3}-[0-9a-f]{12}|00000000-0000-0000-0000-000000000000)$/i.test( + key, + ) + ) + return ( + ("string" === typeof value && + (/^(([^<>()[\]\.,;:\s@\"]+(\.[^<>()[\]\.,;:\s@\"]+)*)|(\".+\"))@(([^<>()[\]\.,;:\s@\"]+\.)+[^<>()[\]\.,;:\s@\"]{2,})$/i.test( + value, + ) || + $guard(_exceptionable, { + path: _path + $join(key), + expected: + 'string & Format<"email">', + value: value, + }))) || + $guard(_exceptionable, { + path: _path + $join(key), + expected: '(string & Format<"email">)', + value: value, + }) + ); + return true; + }); + return ( + ((("object" === typeof input && + null !== input && + false === Array.isArray(input)) || + $guard(true, { + path: _path + "", + expected: "DynamicTag", + value: input, + })) && + $ao0(input, _path + "", true)) || + $guard(true, { + path: _path + "", + expected: "DynamicTag", + value: input, + }) + ); + })(input, "$input", true); + return input; + }, +}); diff --git a/test/generated/output/createRandom/test_createRandom_DynamicTemplate.ts b/test/generated/output/createRandom/test_createRandom_DynamicTemplate.ts index 159a192cb9..6f73bfa438 100644 --- a/test/generated/output/createRandom/test_createRandom_DynamicTemplate.ts +++ b/test/generated/output/createRandom/test_createRandom_DynamicTemplate.ts @@ -84,21 +84,29 @@ export const test_createRandom_DynamicTemplate = _test_random( Object.keys(input).every((key: any) => { const value = input[key]; if (undefined === value) return true; - if (RegExp(/^(prefix_(.*))/).test(key)) + if ( + "string" === typeof key && + RegExp(/^prefix_(.*)/).test(key) + ) return "string" === typeof value; - if (RegExp(/((.*)_postfix)$/).test(key)) + if ( + "string" === typeof key && + RegExp(/(.*)_postfix$/).test(key) + ) return "string" === typeof value; if ( + "string" === typeof key && RegExp( - /^(value_[+-]?\d+(?:\.\d+)?(?:[eE][+-]?\d+)?)$/, + /^value_[+-]?\d+(?:\.\d+)?(?:[eE][+-]?\d+)?$/, ).test(key) ) return ( "number" === typeof value && Number.isFinite(value) ); if ( + "string" === typeof key && RegExp( - /^(between_(.*)_and_[+-]?\d+(?:\.\d+)?(?:[eE][+-]?\d+)?)$/, + /^between_(.*)_and_[+-]?\d+(?:\.\d+)?(?:[eE][+-]?\d+)?$/, ).test(key) ) return "boolean" === typeof value; @@ -128,7 +136,10 @@ export const test_createRandom_DynamicTemplate = _test_random( Object.keys(input).every((key: any) => { const value = input[key]; if (undefined === value) return true; - if (RegExp(/^(prefix_(.*))/).test(key)) + if ( + "string" === typeof key && + RegExp(/^prefix_(.*)/).test(key) + ) return ( "string" === typeof value || $guard(_exceptionable, { @@ -137,7 +148,10 @@ export const test_createRandom_DynamicTemplate = _test_random( value: value, }) ); - if (RegExp(/((.*)_postfix)$/).test(key)) + if ( + "string" === typeof key && + RegExp(/(.*)_postfix$/).test(key) + ) return ( "string" === typeof value || $guard(_exceptionable, { @@ -147,8 +161,9 @@ export const test_createRandom_DynamicTemplate = _test_random( }) ); if ( + "string" === typeof key && RegExp( - /^(value_[+-]?\d+(?:\.\d+)?(?:[eE][+-]?\d+)?)$/, + /^value_[+-]?\d+(?:\.\d+)?(?:[eE][+-]?\d+)?$/, ).test(key) ) return ( @@ -161,8 +176,9 @@ export const test_createRandom_DynamicTemplate = _test_random( }) ); if ( + "string" === typeof key && RegExp( - /^(between_(.*)_and_[+-]?\d+(?:\.\d+)?(?:[eE][+-]?\d+)?)$/, + /^between_(.*)_and_[+-]?\d+(?:\.\d+)?(?:[eE][+-]?\d+)?$/, ).test(key) ) return ( diff --git a/test/generated/output/createRandom/test_createRandom_DynamicTree.ts b/test/generated/output/createRandom/test_createRandom_DynamicTree.ts index 74b0388a18..cb24fc934a 100644 --- a/test/generated/output/createRandom/test_createRandom_DynamicTree.ts +++ b/test/generated/output/createRandom/test_createRandom_DynamicTree.ts @@ -51,7 +51,7 @@ export const test_createRandom_DynamicTree = _test_random( Object.keys(input).every((key: any) => { const value = input[key]; if (undefined === value) return true; - if (RegExp(/(.*)/).test(key)) + if (true) return ( "object" === typeof value && null !== value && @@ -114,7 +114,7 @@ export const test_createRandom_DynamicTree = _test_random( Object.keys(input).every((key: any) => { const value = input[key]; if (undefined === value) return true; - if (RegExp(/(.*)/).test(key)) + if (true) return ( ((("object" === typeof value && null !== value) || diff --git a/test/generated/output/createRandom/test_createRandom_DynamicUndefined.ts b/test/generated/output/createRandom/test_createRandom_DynamicUndefined.ts index e24720e243..386df9ce7b 100644 --- a/test/generated/output/createRandom/test_createRandom_DynamicUndefined.ts +++ b/test/generated/output/createRandom/test_createRandom_DynamicUndefined.ts @@ -31,8 +31,7 @@ export const test_createRandom_DynamicUndefined = _test_random( Object.keys(input).every((key: any) => { const value = input[key]; if (undefined === value) return true; - if (RegExp(/(.*)/).test(key)) - return null !== value && undefined === value; + if (true) return null !== value && undefined === value; return true; }); return ( @@ -59,7 +58,7 @@ export const test_createRandom_DynamicUndefined = _test_random( Object.keys(input).every((key: any) => { const value = input[key]; if (undefined === value) return true; - if (RegExp(/(.*)/).test(key)) + if (true) return ( (null !== value || $guard(_exceptionable, { diff --git a/test/generated/output/createRandom/test_createRandom_DynamicUnion.ts b/test/generated/output/createRandom/test_createRandom_DynamicUnion.ts index ef48fc33b0..2fb0736120 100644 --- a/test/generated/output/createRandom/test_createRandom_DynamicUnion.ts +++ b/test/generated/output/createRandom/test_createRandom_DynamicUnion.ts @@ -85,18 +85,24 @@ export const test_createRandom_DynamicUnion = _test_random( const value = input[key]; if (undefined === value) return true; if ( - RegExp(/^[+-]?\d+(?:\.\d+)?(?:[eE][+-]?\d+)?$/).test( - key, - ) + "number" === typeof Number(key) && + Number.isFinite(Number(key)) ) return "string" === typeof value; - if (RegExp(/^(prefix_(.*))/).test(key)) + if ( + "string" === typeof key && + RegExp(/^prefix_(.*)/).test(key) + ) return "string" === typeof value; - if (RegExp(/((.*)_postfix)$/).test(key)) + if ( + "string" === typeof key && + RegExp(/(.*)_postfix$/).test(key) + ) return "string" === typeof value; if ( + "string" === typeof key && RegExp( - /^(value_between_[+-]?\d+(?:\.\d+)?(?:[eE][+-]?\d+)?_and_[+-]?\d+(?:\.\d+)?(?:[eE][+-]?\d+)?)$/, + /^value_between_[+-]?\d+(?:\.\d+)?(?:[eE][+-]?\d+)?_and_[+-]?\d+(?:\.\d+)?(?:[eE][+-]?\d+)?$/, ).test(key) ) return ( @@ -129,9 +135,8 @@ export const test_createRandom_DynamicUnion = _test_random( const value = input[key]; if (undefined === value) return true; if ( - RegExp( - /^[+-]?\d+(?:\.\d+)?(?:[eE][+-]?\d+)?$/, - ).test(key) + "number" === typeof Number(key) && + Number.isFinite(Number(key)) ) return ( "string" === typeof value || @@ -141,7 +146,10 @@ export const test_createRandom_DynamicUnion = _test_random( value: value, }) ); - if (RegExp(/^(prefix_(.*))/).test(key)) + if ( + "string" === typeof key && + RegExp(/^prefix_(.*)/).test(key) + ) return ( "string" === typeof value || $guard(_exceptionable, { @@ -150,7 +158,10 @@ export const test_createRandom_DynamicUnion = _test_random( value: value, }) ); - if (RegExp(/((.*)_postfix)$/).test(key)) + if ( + "string" === typeof key && + RegExp(/(.*)_postfix$/).test(key) + ) return ( "string" === typeof value || $guard(_exceptionable, { @@ -160,8 +171,9 @@ export const test_createRandom_DynamicUnion = _test_random( }) ); if ( + "string" === typeof key && RegExp( - /^(value_between_[+-]?\d+(?:\.\d+)?(?:[eE][+-]?\d+)?_and_[+-]?\d+(?:\.\d+)?(?:[eE][+-]?\d+)?)$/, + /^value_between_[+-]?\d+(?:\.\d+)?(?:[eE][+-]?\d+)?_and_[+-]?\d+(?:\.\d+)?(?:[eE][+-]?\d+)?$/, ).test(key) ) return ( diff --git a/test/generated/output/createRandom/test_createRandom_ObjectDynamic.ts b/test/generated/output/createRandom/test_createRandom_ObjectDynamic.ts index f18d7d6e8e..370f866747 100644 --- a/test/generated/output/createRandom/test_createRandom_ObjectDynamic.ts +++ b/test/generated/output/createRandom/test_createRandom_ObjectDynamic.ts @@ -44,7 +44,7 @@ export const test_createRandom_ObjectDynamic = _test_random( Object.keys(input).every((key: any) => { const value = input[key]; if (undefined === value) return true; - if (RegExp(/(.*)/).test(key)) + if (true) return ( "string" === typeof value || ("number" === typeof value && @@ -77,7 +77,7 @@ export const test_createRandom_ObjectDynamic = _test_random( Object.keys(input).every((key: any) => { const value = input[key]; if (undefined === value) return true; - if (RegExp(/(.*)/).test(key)) + if (true) return ( "string" === typeof value || ("number" === typeof value && diff --git a/test/generated/output/createRandom/test_createRandom_UltimateUnion.ts b/test/generated/output/createRandom/test_createRandom_UltimateUnion.ts index 5683ce602a..b53550d247 100644 --- a/test/generated/output/createRandom/test_createRandom_UltimateUnion.ts +++ b/test/generated/output/createRandom/test_createRandom_UltimateUnion.ts @@ -2651,7 +2651,7 @@ export const test_createRandom_UltimateUnion = _test_random( Object.keys(input).every((key: any) => { const value = input[key]; if (undefined === value) return true; - if (RegExp(/(.*)/).test(key)) + if (true) return ( "object" === typeof value && null !== value && @@ -2713,7 +2713,7 @@ export const test_createRandom_UltimateUnion = _test_random( Object.keys(input).every((key: any) => { const value = input[key]; if (undefined === value) return true; - if (RegExp(/(.*)/).test(key)) + if (true) return ( "object" === typeof value && null !== value && @@ -5449,7 +5449,7 @@ export const test_createRandom_UltimateUnion = _test_random( Object.keys(input).every((key: any) => { const value = input[key]; if (undefined === value) return true; - if (RegExp(/(.*)/).test(key)) + if (true) return ( ((("object" === typeof value && null !== value && @@ -5695,7 +5695,7 @@ export const test_createRandom_UltimateUnion = _test_random( Object.keys(input).every((key: any) => { const value = input[key]; if (undefined === value) return true; - if (RegExp(/(.*)/).test(key)) + if (true) return ( ((("object" === typeof value && null !== value && diff --git a/test/generated/output/createValidate/test_createValidate_DynamicArray.ts b/test/generated/output/createValidate/test_createValidate_DynamicArray.ts index d10d2476b6..516a3e6079 100644 --- a/test/generated/output/createValidate/test_createValidate_DynamicArray.ts +++ b/test/generated/output/createValidate/test_createValidate_DynamicArray.ts @@ -16,7 +16,7 @@ export const test_createValidate_DynamicArray = _test_validate( Object.keys(input).every((key: any) => { const value = input[key]; if (undefined === value) return true; - if (RegExp(/(.*)/).test(key)) + if (true) return ( Array.isArray(value) && value.every((elem: any) => "string" === typeof elem) @@ -69,7 +69,7 @@ export const test_createValidate_DynamicArray = _test_validate( .map((key: any) => { const value = input[key]; if (undefined === value) return true; - if (RegExp(/(.*)/).test(key)) + if (true) return ( ((Array.isArray(value) || $report(_exceptionable, { diff --git a/test/generated/output/createValidate/test_createValidate_DynamicComposite.ts b/test/generated/output/createValidate/test_createValidate_DynamicComposite.ts index b490794885..f3c970461c 100644 --- a/test/generated/output/createValidate/test_createValidate_DynamicComposite.ts +++ b/test/generated/output/createValidate/test_createValidate_DynamicComposite.ts @@ -17,20 +17,26 @@ export const test_createValidate_DynamicComposite = _test_validate( const value = input[key]; if (undefined === value) return true; if ( - RegExp(/^[+-]?\d+(?:\.\d+)?(?:[eE][+-]?\d+)?$/).test( - key, - ) + "number" === typeof Number(key) && + Number.isFinite(Number(key)) ) return ( "number" === typeof value && Number.isFinite(value) ); - if (RegExp(/^(prefix_(.*))/).test(key)) + if ( + "string" === typeof key && + RegExp(/^prefix_(.*)/).test(key) + ) return "string" === typeof value; - if (RegExp(/((.*)_postfix)$/).test(key)) + if ( + "string" === typeof key && + RegExp(/(.*)_postfix$/).test(key) + ) return "string" === typeof value; if ( + "string" === typeof key && RegExp( - /^(value_[+-]?\d+(?:\.\d+)?(?:[eE][+-]?\d+)?)$/, + /^value_[+-]?\d+(?:\.\d+)?(?:[eE][+-]?\d+)?$/, ).test(key) ) return ( @@ -40,8 +46,9 @@ export const test_createValidate_DynamicComposite = _test_validate( "boolean" === typeof value ); if ( + "string" === typeof key && RegExp( - /^(between_(.*)_and_[+-]?\d+(?:\.\d+)?(?:[eE][+-]?\d+)?)$/, + /^between_(.*)_and_[+-]?\d+(?:\.\d+)?(?:[eE][+-]?\d+)?$/, ).test(key) ) return "boolean" === typeof value; @@ -87,9 +94,8 @@ export const test_createValidate_DynamicComposite = _test_validate( const value = input[key]; if (undefined === value) return true; if ( - RegExp( - /^[+-]?\d+(?:\.\d+)?(?:[eE][+-]?\d+)?$/, - ).test(key) + "number" === typeof Number(key) && + Number.isFinite(Number(key)) ) return ( ("number" === typeof value && @@ -100,7 +106,10 @@ export const test_createValidate_DynamicComposite = _test_validate( value: value, }) ); - if (RegExp(/^(prefix_(.*))/).test(key)) + if ( + "string" === typeof key && + RegExp(/^prefix_(.*)/).test(key) + ) return ( "string" === typeof value || $report(_exceptionable, { @@ -109,7 +118,10 @@ export const test_createValidate_DynamicComposite = _test_validate( value: value, }) ); - if (RegExp(/((.*)_postfix)$/).test(key)) + if ( + "string" === typeof key && + RegExp(/(.*)_postfix$/).test(key) + ) return ( "string" === typeof value || $report(_exceptionable, { @@ -119,8 +131,9 @@ export const test_createValidate_DynamicComposite = _test_validate( }) ); if ( + "string" === typeof key && RegExp( - /^(value_[+-]?\d+(?:\.\d+)?(?:[eE][+-]?\d+)?)$/, + /^value_[+-]?\d+(?:\.\d+)?(?:[eE][+-]?\d+)?$/, ).test(key) ) return ( @@ -136,8 +149,9 @@ export const test_createValidate_DynamicComposite = _test_validate( }) ); if ( + "string" === typeof key && RegExp( - /^(between_(.*)_and_[+-]?\d+(?:\.\d+)?(?:[eE][+-]?\d+)?)$/, + /^between_(.*)_and_[+-]?\d+(?:\.\d+)?(?:[eE][+-]?\d+)?$/, ).test(key) ) return ( diff --git a/test/generated/output/createValidate/test_createValidate_DynamicJsonValue.ts b/test/generated/output/createValidate/test_createValidate_DynamicJsonValue.ts index af0799a434..e6d7905c85 100644 --- a/test/generated/output/createValidate/test_createValidate_DynamicJsonValue.ts +++ b/test/generated/output/createValidate/test_createValidate_DynamicJsonValue.ts @@ -12,7 +12,7 @@ export const test_createValidate_DynamicJsonValue = _test_validate( Object.keys(input).every((key: any) => { const value = input[key]; if (undefined === value) return true; - if (RegExp(/(.*)/).test(key)) + if (true) return ( null === value || undefined === value || @@ -75,7 +75,7 @@ export const test_createValidate_DynamicJsonValue = _test_validate( .map((key: any) => { const value = input[key]; if (undefined === value) return true; - if (RegExp(/(.*)/).test(key)) + if (true) return ( null === value || undefined === value || diff --git a/test/generated/output/createValidate/test_createValidate_DynamicNever.ts b/test/generated/output/createValidate/test_createValidate_DynamicNever.ts index 964ad775e8..03a956c5c5 100644 --- a/test/generated/output/createValidate/test_createValidate_DynamicNever.ts +++ b/test/generated/output/createValidate/test_createValidate_DynamicNever.ts @@ -11,8 +11,7 @@ export const test_createValidate_DynamicNever = _test_validate( Object.keys(input).every((key: any) => { const value = input[key]; if (undefined === value) return true; - if (RegExp(/(.*)/).test(key)) - return null !== value && undefined === value; + if (true) return null !== value && undefined === value; return true; }); return ( @@ -41,7 +40,7 @@ export const test_createValidate_DynamicNever = _test_validate( .map((key: any) => { const value = input[key]; if (undefined === value) return true; - if (RegExp(/(.*)/).test(key)) + if (true) return ( (null !== value || $report(_exceptionable, { diff --git a/test/generated/output/createValidate/test_createValidate_DynamicSimple.ts b/test/generated/output/createValidate/test_createValidate_DynamicSimple.ts index a49409d3ef..878d7ed80f 100644 --- a/test/generated/output/createValidate/test_createValidate_DynamicSimple.ts +++ b/test/generated/output/createValidate/test_createValidate_DynamicSimple.ts @@ -17,7 +17,7 @@ export const test_createValidate_DynamicSimple = _test_validate( Object.keys(input).every((key: any) => { const value = input[key]; if (undefined === value) return true; - if (RegExp(/(.*)/).test(key)) + if (true) return ( "number" === typeof value && Number.isFinite(value) ); @@ -69,7 +69,7 @@ export const test_createValidate_DynamicSimple = _test_validate( .map((key: any) => { const value = input[key]; if (undefined === value) return true; - if (RegExp(/(.*)/).test(key)) + if (true) return ( ("number" === typeof value && Number.isFinite(value)) || diff --git a/test/generated/output/createValidate/test_createValidate_DynamicTag.ts b/test/generated/output/createValidate/test_createValidate_DynamicTag.ts new file mode 100644 index 0000000000..17586e5b7f --- /dev/null +++ b/test/generated/output/createValidate/test_createValidate_DynamicTag.ts @@ -0,0 +1,133 @@ +import typia from "../../../../src"; +import { _test_validate } from "../../../internal/_test_validate"; +import { DynamicTag } from "../../../structures/DynamicTag"; + +export const test_createValidate_DynamicTag = _test_validate( + "DynamicTag", +)(DynamicTag)((input: any): typia.IValidation => { + const errors = [] as any[]; + const __is = (input: any): input is DynamicTag => { + const $io0 = (input: any): boolean => + Object.keys(input).every((key: any) => { + const value = input[key]; + if (undefined === value) return true; + if ( + "number" === typeof Number(key) && + 0 <= Number(key) && + Number(key) < 10 + ) + return "bigint" === typeof value && BigInt(0) <= value; + if ( + "string" === typeof key && + /^(?:[0-9a-f]{8}-[0-9a-f]{4}-[1-5][0-9a-f]{3}-[89ab][0-9a-f]{3}-[0-9a-f]{12}|00000000-0000-0000-0000-000000000000)$/i.test( + key, + ) + ) + return ( + "string" === typeof value && + /^(([^<>()[\]\.,;:\s@\"]+(\.[^<>()[\]\.,;:\s@\"]+)*)|(\".+\"))@(([^<>()[\]\.,;:\s@\"]+\.)+[^<>()[\]\.,;:\s@\"]{2,})$/i.test( + value, + ) + ); + return true; + }); + return ( + "object" === typeof input && + null !== input && + false === Array.isArray(input) && + $io0(input) + ); + }; + if (false === __is(input)) { + const $report = (typia.createValidate as any).report(errors); + (( + input: any, + _path: string, + _exceptionable: boolean = true, + ): input is DynamicTag => { + const $join = (typia.createValidate as any).join; + const $vo0 = ( + input: any, + _path: string, + _exceptionable: boolean = true, + ): boolean => + [ + false === _exceptionable || + Object.keys(input) + .map((key: any) => { + const value = input[key]; + if (undefined === value) return true; + if ( + "number" === typeof Number(key) && + 0 <= Number(key) && + Number(key) < 10 + ) + return ( + ("bigint" === typeof value && + (BigInt(0) <= value || + $report(_exceptionable, { + path: _path + $join(key), + expected: + 'bigint & Type<"uint64">', + value: value, + }))) || + $report(_exceptionable, { + path: _path + $join(key), + expected: + '(bigint & Type<"uint64">)', + value: value, + }) + ); + if ( + "string" === typeof key && + /^(?:[0-9a-f]{8}-[0-9a-f]{4}-[1-5][0-9a-f]{3}-[89ab][0-9a-f]{3}-[0-9a-f]{12}|00000000-0000-0000-0000-000000000000)$/i.test( + key, + ) + ) + return ( + ("string" === typeof value && + (/^(([^<>()[\]\.,;:\s@\"]+(\.[^<>()[\]\.,;:\s@\"]+)*)|(\".+\"))@(([^<>()[\]\.,;:\s@\"]+\.)+[^<>()[\]\.,;:\s@\"]{2,})$/i.test( + value, + ) || + $report(_exceptionable, { + path: _path + $join(key), + expected: + 'string & Format<"email">', + value: value, + }))) || + $report(_exceptionable, { + path: _path + $join(key), + expected: + '(string & Format<"email">)', + value: value, + }) + ); + return true; + }) + .every((flag: boolean) => flag), + ].every((flag: boolean) => flag); + return ( + ((("object" === typeof input && + null !== input && + false === Array.isArray(input)) || + $report(true, { + path: _path + "", + expected: "DynamicTag", + value: input, + })) && + $vo0(input, _path + "", true)) || + $report(true, { + path: _path + "", + expected: "DynamicTag", + value: input, + }) + ); + })(input, "$input", true); + } + const success = 0 === errors.length; + return { + success, + errors, + data: success ? input : undefined, + } as any; +}); diff --git a/test/generated/output/createValidate/test_createValidate_DynamicTemplate.ts b/test/generated/output/createValidate/test_createValidate_DynamicTemplate.ts index 94bca82f7c..f839fbc626 100644 --- a/test/generated/output/createValidate/test_createValidate_DynamicTemplate.ts +++ b/test/generated/output/createValidate/test_createValidate_DynamicTemplate.ts @@ -12,21 +12,29 @@ export const test_createValidate_DynamicTemplate = _test_validate( Object.keys(input).every((key: any) => { const value = input[key]; if (undefined === value) return true; - if (RegExp(/^(prefix_(.*))/).test(key)) + if ( + "string" === typeof key && + RegExp(/^prefix_(.*)/).test(key) + ) return "string" === typeof value; - if (RegExp(/((.*)_postfix)$/).test(key)) + if ( + "string" === typeof key && + RegExp(/(.*)_postfix$/).test(key) + ) return "string" === typeof value; if ( + "string" === typeof key && RegExp( - /^(value_[+-]?\d+(?:\.\d+)?(?:[eE][+-]?\d+)?)$/, + /^value_[+-]?\d+(?:\.\d+)?(?:[eE][+-]?\d+)?$/, ).test(key) ) return ( "number" === typeof value && Number.isFinite(value) ); if ( + "string" === typeof key && RegExp( - /^(between_(.*)_and_[+-]?\d+(?:\.\d+)?(?:[eE][+-]?\d+)?)$/, + /^between_(.*)_and_[+-]?\d+(?:\.\d+)?(?:[eE][+-]?\d+)?$/, ).test(key) ) return "boolean" === typeof value; @@ -58,7 +66,10 @@ export const test_createValidate_DynamicTemplate = _test_validate( .map((key: any) => { const value = input[key]; if (undefined === value) return true; - if (RegExp(/^(prefix_(.*))/).test(key)) + if ( + "string" === typeof key && + RegExp(/^prefix_(.*)/).test(key) + ) return ( "string" === typeof value || $report(_exceptionable, { @@ -67,7 +78,10 @@ export const test_createValidate_DynamicTemplate = _test_validate( value: value, }) ); - if (RegExp(/((.*)_postfix)$/).test(key)) + if ( + "string" === typeof key && + RegExp(/(.*)_postfix$/).test(key) + ) return ( "string" === typeof value || $report(_exceptionable, { @@ -77,8 +91,9 @@ export const test_createValidate_DynamicTemplate = _test_validate( }) ); if ( + "string" === typeof key && RegExp( - /^(value_[+-]?\d+(?:\.\d+)?(?:[eE][+-]?\d+)?)$/, + /^value_[+-]?\d+(?:\.\d+)?(?:[eE][+-]?\d+)?$/, ).test(key) ) return ( @@ -91,8 +106,9 @@ export const test_createValidate_DynamicTemplate = _test_validate( }) ); if ( + "string" === typeof key && RegExp( - /^(between_(.*)_and_[+-]?\d+(?:\.\d+)?(?:[eE][+-]?\d+)?)$/, + /^between_(.*)_and_[+-]?\d+(?:\.\d+)?(?:[eE][+-]?\d+)?$/, ).test(key) ) return ( diff --git a/test/generated/output/createValidate/test_createValidate_DynamicTree.ts b/test/generated/output/createValidate/test_createValidate_DynamicTree.ts index 3cdd966509..eafab1c5f4 100644 --- a/test/generated/output/createValidate/test_createValidate_DynamicTree.ts +++ b/test/generated/output/createValidate/test_createValidate_DynamicTree.ts @@ -19,7 +19,7 @@ export const test_createValidate_DynamicTree = _test_validate( Object.keys(input).every((key: any) => { const value = input[key]; if (undefined === value) return true; - if (RegExp(/(.*)/).test(key)) + if (true) return ( "object" === typeof value && null !== value && @@ -86,7 +86,7 @@ export const test_createValidate_DynamicTree = _test_validate( .map((key: any) => { const value = input[key]; if (undefined === value) return true; - if (RegExp(/(.*)/).test(key)) + if (true) return ( ((("object" === typeof value && null !== value) || diff --git a/test/generated/output/createValidate/test_createValidate_DynamicUndefined.ts b/test/generated/output/createValidate/test_createValidate_DynamicUndefined.ts index 5d8a88ccdb..b19a75071f 100644 --- a/test/generated/output/createValidate/test_createValidate_DynamicUndefined.ts +++ b/test/generated/output/createValidate/test_createValidate_DynamicUndefined.ts @@ -12,8 +12,7 @@ export const test_createValidate_DynamicUndefined = _test_validate( Object.keys(input).every((key: any) => { const value = input[key]; if (undefined === value) return true; - if (RegExp(/(.*)/).test(key)) - return null !== value && undefined === value; + if (true) return null !== value && undefined === value; return true; }); return ( @@ -42,7 +41,7 @@ export const test_createValidate_DynamicUndefined = _test_validate( .map((key: any) => { const value = input[key]; if (undefined === value) return true; - if (RegExp(/(.*)/).test(key)) + if (true) return ( (null !== value || $report(_exceptionable, { diff --git a/test/generated/output/createValidate/test_createValidate_DynamicUnion.ts b/test/generated/output/createValidate/test_createValidate_DynamicUnion.ts index 4d882cdc8e..6946862779 100644 --- a/test/generated/output/createValidate/test_createValidate_DynamicUnion.ts +++ b/test/generated/output/createValidate/test_createValidate_DynamicUnion.ts @@ -11,15 +11,22 @@ export const test_createValidate_DynamicUnion = _test_validate( Object.keys(input).every((key: any) => { const value = input[key]; if (undefined === value) return true; - if (RegExp(/^[+-]?\d+(?:\.\d+)?(?:[eE][+-]?\d+)?$/).test(key)) + if ( + "number" === typeof Number(key) && + Number.isFinite(Number(key)) + ) return "string" === typeof value; - if (RegExp(/^(prefix_(.*))/).test(key)) + if ("string" === typeof key && RegExp(/^prefix_(.*)/).test(key)) return "string" === typeof value; - if (RegExp(/((.*)_postfix)$/).test(key)) + if ( + "string" === typeof key && + RegExp(/(.*)_postfix$/).test(key) + ) return "string" === typeof value; if ( + "string" === typeof key && RegExp( - /^(value_between_[+-]?\d+(?:\.\d+)?(?:[eE][+-]?\d+)?_and_[+-]?\d+(?:\.\d+)?(?:[eE][+-]?\d+)?)$/, + /^value_between_[+-]?\d+(?:\.\d+)?(?:[eE][+-]?\d+)?_and_[+-]?\d+(?:\.\d+)?(?:[eE][+-]?\d+)?$/, ).test(key) ) return "number" === typeof value && Number.isFinite(value); @@ -52,9 +59,8 @@ export const test_createValidate_DynamicUnion = _test_validate( const value = input[key]; if (undefined === value) return true; if ( - RegExp( - /^[+-]?\d+(?:\.\d+)?(?:[eE][+-]?\d+)?$/, - ).test(key) + "number" === typeof Number(key) && + Number.isFinite(Number(key)) ) return ( "string" === typeof value || @@ -64,7 +70,10 @@ export const test_createValidate_DynamicUnion = _test_validate( value: value, }) ); - if (RegExp(/^(prefix_(.*))/).test(key)) + if ( + "string" === typeof key && + RegExp(/^prefix_(.*)/).test(key) + ) return ( "string" === typeof value || $report(_exceptionable, { @@ -73,7 +82,10 @@ export const test_createValidate_DynamicUnion = _test_validate( value: value, }) ); - if (RegExp(/((.*)_postfix)$/).test(key)) + if ( + "string" === typeof key && + RegExp(/(.*)_postfix$/).test(key) + ) return ( "string" === typeof value || $report(_exceptionable, { @@ -83,8 +95,9 @@ export const test_createValidate_DynamicUnion = _test_validate( }) ); if ( + "string" === typeof key && RegExp( - /^(value_between_[+-]?\d+(?:\.\d+)?(?:[eE][+-]?\d+)?_and_[+-]?\d+(?:\.\d+)?(?:[eE][+-]?\d+)?)$/, + /^value_between_[+-]?\d+(?:\.\d+)?(?:[eE][+-]?\d+)?_and_[+-]?\d+(?:\.\d+)?(?:[eE][+-]?\d+)?$/, ).test(key) ) return ( diff --git a/test/generated/output/createValidate/test_createValidate_ObjectDynamic.ts b/test/generated/output/createValidate/test_createValidate_ObjectDynamic.ts index d3356e2039..0071288faa 100644 --- a/test/generated/output/createValidate/test_createValidate_ObjectDynamic.ts +++ b/test/generated/output/createValidate/test_createValidate_ObjectDynamic.ts @@ -12,7 +12,7 @@ export const test_createValidate_ObjectDynamic = _test_validate( Object.keys(input).every((key: any) => { const value = input[key]; if (undefined === value) return true; - if (RegExp(/(.*)/).test(key)) + if (true) return ( "string" === typeof value || ("number" === typeof value && @@ -47,7 +47,7 @@ export const test_createValidate_ObjectDynamic = _test_validate( .map((key: any) => { const value = input[key]; if (undefined === value) return true; - if (RegExp(/(.*)/).test(key)) + if (true) return ( "string" === typeof value || ("number" === typeof value && diff --git a/test/generated/output/createValidate/test_createValidate_UltimateUnion.ts b/test/generated/output/createValidate/test_createValidate_UltimateUnion.ts index fef7a04955..a9e2624b4d 100644 --- a/test/generated/output/createValidate/test_createValidate_UltimateUnion.ts +++ b/test/generated/output/createValidate/test_createValidate_UltimateUnion.ts @@ -514,7 +514,7 @@ export const test_createValidate_UltimateUnion = _test_validate( Object.keys(input).every((key: any) => { const value = input[key]; if (undefined === value) return true; - if (RegExp(/(.*)/).test(key)) + if (true) return ( "object" === typeof value && null !== value && @@ -576,7 +576,7 @@ export const test_createValidate_UltimateUnion = _test_validate( Object.keys(input).every((key: any) => { const value = input[key]; if (undefined === value) return true; - if (RegExp(/(.*)/).test(key)) + if (true) return ( "object" === typeof value && null !== value && @@ -3485,7 +3485,7 @@ export const test_createValidate_UltimateUnion = _test_validate( .map((key: any) => { const value = input[key]; if (undefined === value) return true; - if (RegExp(/(.*)/).test(key)) + if (true) return ( ((("object" === typeof value && null !== value && @@ -3752,7 +3752,7 @@ export const test_createValidate_UltimateUnion = _test_validate( .map((key: any) => { const value = input[key]; if (undefined === value) return true; - if (RegExp(/(.*)/).test(key)) + if (true) return ( ((("object" === typeof value && null !== value && diff --git a/test/generated/output/createValidateEquals/test_createValidateEquals_DynamicComposite.ts b/test/generated/output/createValidateEquals/test_createValidateEquals_DynamicComposite.ts index 7cadbca4d8..ae109e5322 100644 --- a/test/generated/output/createValidateEquals/test_createValidateEquals_DynamicComposite.ts +++ b/test/generated/output/createValidateEquals/test_createValidateEquals_DynamicComposite.ts @@ -24,20 +24,26 @@ export const test_createValidateEquals_DynamicComposite = _test_validateEquals( const value = input[key]; if (undefined === value) return true; if ( - RegExp(/^[+-]?\d+(?:\.\d+)?(?:[eE][+-]?\d+)?$/).test( - key, - ) + "number" === typeof Number(key) && + Number.isFinite(Number(key)) ) return ( "number" === typeof value && Number.isFinite(value) ); - if (RegExp(/^(prefix_(.*))/).test(key)) + if ( + "string" === typeof key && + RegExp(/^prefix_(.*)/).test(key) + ) return "string" === typeof value; - if (RegExp(/((.*)_postfix)$/).test(key)) + if ( + "string" === typeof key && + RegExp(/(.*)_postfix$/).test(key) + ) return "string" === typeof value; if ( + "string" === typeof key && RegExp( - /^(value_[+-]?\d+(?:\.\d+)?(?:[eE][+-]?\d+)?)$/, + /^value_[+-]?\d+(?:\.\d+)?(?:[eE][+-]?\d+)?$/, ).test(key) ) return ( @@ -47,8 +53,9 @@ export const test_createValidateEquals_DynamicComposite = _test_validateEquals( "boolean" === typeof value ); if ( + "string" === typeof key && RegExp( - /^(between_(.*)_and_[+-]?\d+(?:\.\d+)?(?:[eE][+-]?\d+)?)$/, + /^between_(.*)_and_[+-]?\d+(?:\.\d+)?(?:[eE][+-]?\d+)?$/, ).test(key) ) return "boolean" === typeof value; @@ -96,9 +103,8 @@ export const test_createValidateEquals_DynamicComposite = _test_validateEquals( const value = input[key]; if (undefined === value) return true; if ( - RegExp( - /^[+-]?\d+(?:\.\d+)?(?:[eE][+-]?\d+)?$/, - ).test(key) + "number" === typeof Number(key) && + Number.isFinite(Number(key)) ) return ( ("number" === typeof value && @@ -109,7 +115,10 @@ export const test_createValidateEquals_DynamicComposite = _test_validateEquals( value: value, }) ); - if (RegExp(/^(prefix_(.*))/).test(key)) + if ( + "string" === typeof key && + RegExp(/^prefix_(.*)/).test(key) + ) return ( "string" === typeof value || $report(_exceptionable, { @@ -118,7 +127,10 @@ export const test_createValidateEquals_DynamicComposite = _test_validateEquals( value: value, }) ); - if (RegExp(/((.*)_postfix)$/).test(key)) + if ( + "string" === typeof key && + RegExp(/(.*)_postfix$/).test(key) + ) return ( "string" === typeof value || $report(_exceptionable, { @@ -128,8 +140,9 @@ export const test_createValidateEquals_DynamicComposite = _test_validateEquals( }) ); if ( + "string" === typeof key && RegExp( - /^(value_[+-]?\d+(?:\.\d+)?(?:[eE][+-]?\d+)?)$/, + /^value_[+-]?\d+(?:\.\d+)?(?:[eE][+-]?\d+)?$/, ).test(key) ) return ( @@ -145,8 +158,9 @@ export const test_createValidateEquals_DynamicComposite = _test_validateEquals( }) ); if ( + "string" === typeof key && RegExp( - /^(between_(.*)_and_[+-]?\d+(?:\.\d+)?(?:[eE][+-]?\d+)?)$/, + /^between_(.*)_and_[+-]?\d+(?:\.\d+)?(?:[eE][+-]?\d+)?$/, ).test(key) ) return ( diff --git a/test/generated/output/createValidateEquals/test_createValidateEquals_DynamicTag.ts b/test/generated/output/createValidateEquals/test_createValidateEquals_DynamicTag.ts new file mode 100644 index 0000000000..99232b2f12 --- /dev/null +++ b/test/generated/output/createValidateEquals/test_createValidateEquals_DynamicTag.ts @@ -0,0 +1,141 @@ +import typia from "../../../../src"; +import { _test_validateEquals } from "../../../internal/_test_validateEquals"; +import { DynamicTag } from "../../../structures/DynamicTag"; + +export const test_createValidateEquals_DynamicTag = _test_validateEquals( + "DynamicTag", +)(DynamicTag)((input: any): typia.IValidation => { + const errors = [] as any[]; + const __is = ( + input: any, + _exceptionable: boolean = true, + ): input is DynamicTag => { + const $join = (typia.createValidateEquals as any).join; + const $io0 = (input: any, _exceptionable: boolean = true): boolean => + Object.keys(input).every((key: any) => { + const value = input[key]; + if (undefined === value) return true; + if ( + "number" === typeof Number(key) && + 0 <= Number(key) && + Number(key) < 10 + ) + return "bigint" === typeof value && BigInt(0) <= value; + if ( + "string" === typeof key && + /^(?:[0-9a-f]{8}-[0-9a-f]{4}-[1-5][0-9a-f]{3}-[89ab][0-9a-f]{3}-[0-9a-f]{12}|00000000-0000-0000-0000-000000000000)$/i.test( + key, + ) + ) + return ( + "string" === typeof value && + /^(([^<>()[\]\.,;:\s@\"]+(\.[^<>()[\]\.,;:\s@\"]+)*)|(\".+\"))@(([^<>()[\]\.,;:\s@\"]+\.)+[^<>()[\]\.,;:\s@\"]{2,})$/i.test( + value, + ) + ); + return false; + }); + return ( + "object" === typeof input && + null !== input && + false === Array.isArray(input) && + $io0(input, true) + ); + }; + if (false === __is(input)) { + const $report = (typia.createValidateEquals as any).report(errors); + (( + input: any, + _path: string, + _exceptionable: boolean = true, + ): input is DynamicTag => { + const $join = (typia.createValidateEquals as any).join; + const $vo0 = ( + input: any, + _path: string, + _exceptionable: boolean = true, + ): boolean => + [ + false === _exceptionable || + Object.keys(input) + .map((key: any) => { + const value = input[key]; + if (undefined === value) return true; + if ( + "number" === typeof Number(key) && + 0 <= Number(key) && + Number(key) < 10 + ) + return ( + ("bigint" === typeof value && + (BigInt(0) <= value || + $report(_exceptionable, { + path: _path + $join(key), + expected: + 'bigint & Type<"uint64">', + value: value, + }))) || + $report(_exceptionable, { + path: _path + $join(key), + expected: + '(bigint & Type<"uint64">)', + value: value, + }) + ); + if ( + "string" === typeof key && + /^(?:[0-9a-f]{8}-[0-9a-f]{4}-[1-5][0-9a-f]{3}-[89ab][0-9a-f]{3}-[0-9a-f]{12}|00000000-0000-0000-0000-000000000000)$/i.test( + key, + ) + ) + return ( + ("string" === typeof value && + (/^(([^<>()[\]\.,;:\s@\"]+(\.[^<>()[\]\.,;:\s@\"]+)*)|(\".+\"))@(([^<>()[\]\.,;:\s@\"]+\.)+[^<>()[\]\.,;:\s@\"]{2,})$/i.test( + value, + ) || + $report(_exceptionable, { + path: _path + $join(key), + expected: + 'string & Format<"email">', + value: value, + }))) || + $report(_exceptionable, { + path: _path + $join(key), + expected: + '(string & Format<"email">)', + value: value, + }) + ); + return $report(_exceptionable, { + path: _path + $join(key), + expected: "undefined", + value: value, + }); + }) + .every((flag: boolean) => flag), + ].every((flag: boolean) => flag); + return ( + ((("object" === typeof input && + null !== input && + false === Array.isArray(input)) || + $report(true, { + path: _path + "", + expected: "DynamicTag", + value: input, + })) && + $vo0(input, _path + "", true)) || + $report(true, { + path: _path + "", + expected: "DynamicTag", + value: input, + }) + ); + })(input, "$input", true); + } + const success = 0 === errors.length; + return { + success, + errors, + data: success ? input : undefined, + } as any; +}); diff --git a/test/generated/output/createValidateEquals/test_createValidateEquals_DynamicTemplate.ts b/test/generated/output/createValidateEquals/test_createValidateEquals_DynamicTemplate.ts index 188b0e562f..1365a2db07 100644 --- a/test/generated/output/createValidateEquals/test_createValidateEquals_DynamicTemplate.ts +++ b/test/generated/output/createValidateEquals/test_createValidateEquals_DynamicTemplate.ts @@ -19,21 +19,29 @@ export const test_createValidateEquals_DynamicTemplate = _test_validateEquals( Object.keys(input).every((key: any) => { const value = input[key]; if (undefined === value) return true; - if (RegExp(/^(prefix_(.*))/).test(key)) + if ( + "string" === typeof key && + RegExp(/^prefix_(.*)/).test(key) + ) return "string" === typeof value; - if (RegExp(/((.*)_postfix)$/).test(key)) + if ( + "string" === typeof key && + RegExp(/(.*)_postfix$/).test(key) + ) return "string" === typeof value; if ( + "string" === typeof key && RegExp( - /^(value_[+-]?\d+(?:\.\d+)?(?:[eE][+-]?\d+)?)$/, + /^value_[+-]?\d+(?:\.\d+)?(?:[eE][+-]?\d+)?$/, ).test(key) ) return ( "number" === typeof value && Number.isFinite(value) ); if ( + "string" === typeof key && RegExp( - /^(between_(.*)_and_[+-]?\d+(?:\.\d+)?(?:[eE][+-]?\d+)?)$/, + /^between_(.*)_and_[+-]?\d+(?:\.\d+)?(?:[eE][+-]?\d+)?$/, ).test(key) ) return "boolean" === typeof value; @@ -65,7 +73,10 @@ export const test_createValidateEquals_DynamicTemplate = _test_validateEquals( .map((key: any) => { const value = input[key]; if (undefined === value) return true; - if (RegExp(/^(prefix_(.*))/).test(key)) + if ( + "string" === typeof key && + RegExp(/^prefix_(.*)/).test(key) + ) return ( "string" === typeof value || $report(_exceptionable, { @@ -74,7 +85,10 @@ export const test_createValidateEquals_DynamicTemplate = _test_validateEquals( value: value, }) ); - if (RegExp(/((.*)_postfix)$/).test(key)) + if ( + "string" === typeof key && + RegExp(/(.*)_postfix$/).test(key) + ) return ( "string" === typeof value || $report(_exceptionable, { @@ -84,8 +98,9 @@ export const test_createValidateEquals_DynamicTemplate = _test_validateEquals( }) ); if ( + "string" === typeof key && RegExp( - /^(value_[+-]?\d+(?:\.\d+)?(?:[eE][+-]?\d+)?)$/, + /^value_[+-]?\d+(?:\.\d+)?(?:[eE][+-]?\d+)?$/, ).test(key) ) return ( @@ -98,8 +113,9 @@ export const test_createValidateEquals_DynamicTemplate = _test_validateEquals( }) ); if ( + "string" === typeof key && RegExp( - /^(between_(.*)_and_[+-]?\d+(?:\.\d+)?(?:[eE][+-]?\d+)?)$/, + /^between_(.*)_and_[+-]?\d+(?:\.\d+)?(?:[eE][+-]?\d+)?$/, ).test(key) ) return ( diff --git a/test/generated/output/createValidateEquals/test_createValidateEquals_DynamicUnion.ts b/test/generated/output/createValidateEquals/test_createValidateEquals_DynamicUnion.ts index db95059397..897796835d 100644 --- a/test/generated/output/createValidateEquals/test_createValidateEquals_DynamicUnion.ts +++ b/test/generated/output/createValidateEquals/test_createValidateEquals_DynamicUnion.ts @@ -15,15 +15,22 @@ export const test_createValidateEquals_DynamicUnion = _test_validateEquals( Object.keys(input).every((key: any) => { const value = input[key]; if (undefined === value) return true; - if (RegExp(/^[+-]?\d+(?:\.\d+)?(?:[eE][+-]?\d+)?$/).test(key)) + if ( + "number" === typeof Number(key) && + Number.isFinite(Number(key)) + ) return "string" === typeof value; - if (RegExp(/^(prefix_(.*))/).test(key)) + if ("string" === typeof key && RegExp(/^prefix_(.*)/).test(key)) return "string" === typeof value; - if (RegExp(/((.*)_postfix)$/).test(key)) + if ( + "string" === typeof key && + RegExp(/(.*)_postfix$/).test(key) + ) return "string" === typeof value; if ( + "string" === typeof key && RegExp( - /^(value_between_[+-]?\d+(?:\.\d+)?(?:[eE][+-]?\d+)?_and_[+-]?\d+(?:\.\d+)?(?:[eE][+-]?\d+)?)$/, + /^value_between_[+-]?\d+(?:\.\d+)?(?:[eE][+-]?\d+)?_and_[+-]?\d+(?:\.\d+)?(?:[eE][+-]?\d+)?$/, ).test(key) ) return "number" === typeof value && Number.isFinite(value); @@ -56,9 +63,8 @@ export const test_createValidateEquals_DynamicUnion = _test_validateEquals( const value = input[key]; if (undefined === value) return true; if ( - RegExp( - /^[+-]?\d+(?:\.\d+)?(?:[eE][+-]?\d+)?$/, - ).test(key) + "number" === typeof Number(key) && + Number.isFinite(Number(key)) ) return ( "string" === typeof value || @@ -68,7 +74,10 @@ export const test_createValidateEquals_DynamicUnion = _test_validateEquals( value: value, }) ); - if (RegExp(/^(prefix_(.*))/).test(key)) + if ( + "string" === typeof key && + RegExp(/^prefix_(.*)/).test(key) + ) return ( "string" === typeof value || $report(_exceptionable, { @@ -77,7 +86,10 @@ export const test_createValidateEquals_DynamicUnion = _test_validateEquals( value: value, }) ); - if (RegExp(/((.*)_postfix)$/).test(key)) + if ( + "string" === typeof key && + RegExp(/(.*)_postfix$/).test(key) + ) return ( "string" === typeof value || $report(_exceptionable, { @@ -87,8 +99,9 @@ export const test_createValidateEquals_DynamicUnion = _test_validateEquals( }) ); if ( + "string" === typeof key && RegExp( - /^(value_between_[+-]?\d+(?:\.\d+)?(?:[eE][+-]?\d+)?_and_[+-]?\d+(?:\.\d+)?(?:[eE][+-]?\d+)?)$/, + /^value_between_[+-]?\d+(?:\.\d+)?(?:[eE][+-]?\d+)?_and_[+-]?\d+(?:\.\d+)?(?:[eE][+-]?\d+)?$/, ).test(key) ) return ( diff --git a/test/generated/output/equals/test_equals_DynamicComposite.ts b/test/generated/output/equals/test_equals_DynamicComposite.ts index aa4ba1d897..2586c6b795 100644 --- a/test/generated/output/equals/test_equals_DynamicComposite.ts +++ b/test/generated/output/equals/test_equals_DynamicComposite.ts @@ -18,16 +18,23 @@ export const test_equals_DynamicComposite = _test_equals( return true; const value = input[key]; if (undefined === value) return true; - if (RegExp(/^[+-]?\d+(?:\.\d+)?(?:[eE][+-]?\d+)?$/).test(key)) + if ( + "number" === typeof Number(key) && + Number.isFinite(Number(key)) + ) return "number" === typeof value && Number.isFinite(value); - if (RegExp(/^(prefix_(.*))/).test(key)) + if ("string" === typeof key && RegExp(/^prefix_(.*)/).test(key)) return "string" === typeof value; - if (RegExp(/((.*)_postfix)$/).test(key)) + if ( + "string" === typeof key && + RegExp(/(.*)_postfix$/).test(key) + ) return "string" === typeof value; if ( - RegExp( - /^(value_[+-]?\d+(?:\.\d+)?(?:[eE][+-]?\d+)?)$/, - ).test(key) + "string" === typeof key && + RegExp(/^value_[+-]?\d+(?:\.\d+)?(?:[eE][+-]?\d+)?$/).test( + key, + ) ) return ( "string" === typeof value || @@ -35,8 +42,9 @@ export const test_equals_DynamicComposite = _test_equals( "boolean" === typeof value ); if ( + "string" === typeof key && RegExp( - /^(between_(.*)_and_[+-]?\d+(?:\.\d+)?(?:[eE][+-]?\d+)?)$/, + /^between_(.*)_and_[+-]?\d+(?:\.\d+)?(?:[eE][+-]?\d+)?$/, ).test(key) ) return "boolean" === typeof value; diff --git a/test/generated/output/equals/test_equals_DynamicTag.ts b/test/generated/output/equals/test_equals_DynamicTag.ts new file mode 100644 index 0000000000..d0d2a815a5 --- /dev/null +++ b/test/generated/output/equals/test_equals_DynamicTag.ts @@ -0,0 +1,41 @@ +import typia from "../../../../src"; +import { _test_equals } from "../../../internal/_test_equals"; +import { DynamicTag } from "../../../structures/DynamicTag"; + +export const test_equals_DynamicTag = _test_equals("DynamicTag")( + DynamicTag, +)((input) => + ((input: any, _exceptionable: boolean = true): input is DynamicTag => { + const $join = (typia.equals as any).join; + const $io0 = (input: any, _exceptionable: boolean = true): boolean => + Object.keys(input).every((key: any) => { + const value = input[key]; + if (undefined === value) return true; + if ( + "number" === typeof Number(key) && + 0 <= Number(key) && + Number(key) < 10 + ) + return "bigint" === typeof value && BigInt(0) <= value; + if ( + "string" === typeof key && + /^(?:[0-9a-f]{8}-[0-9a-f]{4}-[1-5][0-9a-f]{3}-[89ab][0-9a-f]{3}-[0-9a-f]{12}|00000000-0000-0000-0000-000000000000)$/i.test( + key, + ) + ) + return ( + "string" === typeof value && + /^(([^<>()[\]\.,;:\s@\"]+(\.[^<>()[\]\.,;:\s@\"]+)*)|(\".+\"))@(([^<>()[\]\.,;:\s@\"]+\.)+[^<>()[\]\.,;:\s@\"]{2,})$/i.test( + value, + ) + ); + return false; + }); + return ( + "object" === typeof input && + null !== input && + false === Array.isArray(input) && + $io0(input, true) + ); + })(input), +); diff --git a/test/generated/output/equals/test_equals_DynamicTemplate.ts b/test/generated/output/equals/test_equals_DynamicTemplate.ts index 4aa98e8bd5..fc5a6b3441 100644 --- a/test/generated/output/equals/test_equals_DynamicTemplate.ts +++ b/test/generated/output/equals/test_equals_DynamicTemplate.ts @@ -11,19 +11,24 @@ export const test_equals_DynamicTemplate = _test_equals( Object.keys(input).every((key: any) => { const value = input[key]; if (undefined === value) return true; - if (RegExp(/^(prefix_(.*))/).test(key)) + if ("string" === typeof key && RegExp(/^prefix_(.*)/).test(key)) return "string" === typeof value; - if (RegExp(/((.*)_postfix)$/).test(key)) + if ( + "string" === typeof key && + RegExp(/(.*)_postfix$/).test(key) + ) return "string" === typeof value; if ( - RegExp( - /^(value_[+-]?\d+(?:\.\d+)?(?:[eE][+-]?\d+)?)$/, - ).test(key) + "string" === typeof key && + RegExp(/^value_[+-]?\d+(?:\.\d+)?(?:[eE][+-]?\d+)?$/).test( + key, + ) ) return "number" === typeof value && Number.isFinite(value); if ( + "string" === typeof key && RegExp( - /^(between_(.*)_and_[+-]?\d+(?:\.\d+)?(?:[eE][+-]?\d+)?)$/, + /^between_(.*)_and_[+-]?\d+(?:\.\d+)?(?:[eE][+-]?\d+)?$/, ).test(key) ) return "boolean" === typeof value; diff --git a/test/generated/output/equals/test_equals_DynamicUnion.ts b/test/generated/output/equals/test_equals_DynamicUnion.ts index bb59939d69..319df81b4f 100644 --- a/test/generated/output/equals/test_equals_DynamicUnion.ts +++ b/test/generated/output/equals/test_equals_DynamicUnion.ts @@ -11,15 +11,22 @@ export const test_equals_DynamicUnion = _test_equals( Object.keys(input).every((key: any) => { const value = input[key]; if (undefined === value) return true; - if (RegExp(/^[+-]?\d+(?:\.\d+)?(?:[eE][+-]?\d+)?$/).test(key)) + if ( + "number" === typeof Number(key) && + Number.isFinite(Number(key)) + ) return "string" === typeof value; - if (RegExp(/^(prefix_(.*))/).test(key)) + if ("string" === typeof key && RegExp(/^prefix_(.*)/).test(key)) return "string" === typeof value; - if (RegExp(/((.*)_postfix)$/).test(key)) + if ( + "string" === typeof key && + RegExp(/(.*)_postfix$/).test(key) + ) return "string" === typeof value; if ( + "string" === typeof key && RegExp( - /^(value_between_[+-]?\d+(?:\.\d+)?(?:[eE][+-]?\d+)?_and_[+-]?\d+(?:\.\d+)?(?:[eE][+-]?\d+)?)$/, + /^value_between_[+-]?\d+(?:\.\d+)?(?:[eE][+-]?\d+)?_and_[+-]?\d+(?:\.\d+)?(?:[eE][+-]?\d+)?$/, ).test(key) ) return "number" === typeof value && Number.isFinite(value); diff --git a/test/generated/output/is/test_is_DynamicArray.ts b/test/generated/output/is/test_is_DynamicArray.ts index e94b069b9a..96e2222d73 100644 --- a/test/generated/output/is/test_is_DynamicArray.ts +++ b/test/generated/output/is/test_is_DynamicArray.ts @@ -15,7 +15,7 @@ export const test_is_DynamicArray = _test_is("DynamicArray")( Object.keys(input).every((key: any) => { const value = input[key]; if (undefined === value) return true; - if (RegExp(/(.*)/).test(key)) + if (true) return ( Array.isArray(value) && value.every((elem: any) => "string" === typeof elem) diff --git a/test/generated/output/is/test_is_DynamicComposite.ts b/test/generated/output/is/test_is_DynamicComposite.ts index 0b1360d071..532d87c83d 100644 --- a/test/generated/output/is/test_is_DynamicComposite.ts +++ b/test/generated/output/is/test_is_DynamicComposite.ts @@ -14,16 +14,23 @@ export const test_is_DynamicComposite = _test_is( return true; const value = input[key]; if (undefined === value) return true; - if (RegExp(/^[+-]?\d+(?:\.\d+)?(?:[eE][+-]?\d+)?$/).test(key)) + if ( + "number" === typeof Number(key) && + Number.isFinite(Number(key)) + ) return "number" === typeof value && Number.isFinite(value); - if (RegExp(/^(prefix_(.*))/).test(key)) + if ("string" === typeof key && RegExp(/^prefix_(.*)/).test(key)) return "string" === typeof value; - if (RegExp(/((.*)_postfix)$/).test(key)) + if ( + "string" === typeof key && + RegExp(/(.*)_postfix$/).test(key) + ) return "string" === typeof value; if ( - RegExp( - /^(value_[+-]?\d+(?:\.\d+)?(?:[eE][+-]?\d+)?)$/, - ).test(key) + "string" === typeof key && + RegExp(/^value_[+-]?\d+(?:\.\d+)?(?:[eE][+-]?\d+)?$/).test( + key, + ) ) return ( "string" === typeof value || @@ -31,8 +38,9 @@ export const test_is_DynamicComposite = _test_is( "boolean" === typeof value ); if ( + "string" === typeof key && RegExp( - /^(between_(.*)_and_[+-]?\d+(?:\.\d+)?(?:[eE][+-]?\d+)?)$/, + /^between_(.*)_and_[+-]?\d+(?:\.\d+)?(?:[eE][+-]?\d+)?$/, ).test(key) ) return "boolean" === typeof value; diff --git a/test/generated/output/is/test_is_DynamicJsonValue.ts b/test/generated/output/is/test_is_DynamicJsonValue.ts index 5bf8347ce5..620697624f 100644 --- a/test/generated/output/is/test_is_DynamicJsonValue.ts +++ b/test/generated/output/is/test_is_DynamicJsonValue.ts @@ -10,7 +10,7 @@ export const test_is_DynamicJsonValue = _test_is( Object.keys(input).every((key: any) => { const value = input[key]; if (undefined === value) return true; - if (RegExp(/(.*)/).test(key)) + if (true) return ( null === value || undefined === value || diff --git a/test/generated/output/is/test_is_DynamicNever.ts b/test/generated/output/is/test_is_DynamicNever.ts index 21a63bd0fd..2ec6ff9f91 100644 --- a/test/generated/output/is/test_is_DynamicNever.ts +++ b/test/generated/output/is/test_is_DynamicNever.ts @@ -10,8 +10,7 @@ export const test_is_DynamicNever = _test_is("DynamicNever")( Object.keys(input).every((key: any) => { const value = input[key]; if (undefined === value) return true; - if (RegExp(/(.*)/).test(key)) - return null !== value && undefined === value; + if (true) return null !== value && undefined === value; return true; }); return ( diff --git a/test/generated/output/is/test_is_DynamicSimple.ts b/test/generated/output/is/test_is_DynamicSimple.ts index 4b39ad9d28..b26662eeec 100644 --- a/test/generated/output/is/test_is_DynamicSimple.ts +++ b/test/generated/output/is/test_is_DynamicSimple.ts @@ -15,7 +15,7 @@ export const test_is_DynamicSimple = _test_is("DynamicSimple")( Object.keys(input).every((key: any) => { const value = input[key]; if (undefined === value) return true; - if (RegExp(/(.*)/).test(key)) + if (true) return "number" === typeof value && Number.isFinite(value); return true; }); diff --git a/test/generated/output/is/test_is_DynamicTag.ts b/test/generated/output/is/test_is_DynamicTag.ts new file mode 100644 index 0000000000..ae052ee910 --- /dev/null +++ b/test/generated/output/is/test_is_DynamicTag.ts @@ -0,0 +1,40 @@ +import typia from "../../../../src"; +import { _test_is } from "../../../internal/_test_is"; +import { DynamicTag } from "../../../structures/DynamicTag"; + +export const test_is_DynamicTag = _test_is("DynamicTag")( + DynamicTag, +)((input) => + ((input: any): input is DynamicTag => { + const $io0 = (input: any): boolean => + Object.keys(input).every((key: any) => { + const value = input[key]; + if (undefined === value) return true; + if ( + "number" === typeof Number(key) && + 0 <= Number(key) && + Number(key) < 10 + ) + return "bigint" === typeof value && BigInt(0) <= value; + if ( + "string" === typeof key && + /^(?:[0-9a-f]{8}-[0-9a-f]{4}-[1-5][0-9a-f]{3}-[89ab][0-9a-f]{3}-[0-9a-f]{12}|00000000-0000-0000-0000-000000000000)$/i.test( + key, + ) + ) + return ( + "string" === typeof value && + /^(([^<>()[\]\.,;:\s@\"]+(\.[^<>()[\]\.,;:\s@\"]+)*)|(\".+\"))@(([^<>()[\]\.,;:\s@\"]+\.)+[^<>()[\]\.,;:\s@\"]{2,})$/i.test( + value, + ) + ); + return true; + }); + return ( + "object" === typeof input && + null !== input && + false === Array.isArray(input) && + $io0(input) + ); + })(input), +); diff --git a/test/generated/output/is/test_is_DynamicTemplate.ts b/test/generated/output/is/test_is_DynamicTemplate.ts index a4e8c31f5e..a497094383 100644 --- a/test/generated/output/is/test_is_DynamicTemplate.ts +++ b/test/generated/output/is/test_is_DynamicTemplate.ts @@ -10,19 +10,24 @@ export const test_is_DynamicTemplate = _test_is( Object.keys(input).every((key: any) => { const value = input[key]; if (undefined === value) return true; - if (RegExp(/^(prefix_(.*))/).test(key)) + if ("string" === typeof key && RegExp(/^prefix_(.*)/).test(key)) return "string" === typeof value; - if (RegExp(/((.*)_postfix)$/).test(key)) + if ( + "string" === typeof key && + RegExp(/(.*)_postfix$/).test(key) + ) return "string" === typeof value; if ( - RegExp( - /^(value_[+-]?\d+(?:\.\d+)?(?:[eE][+-]?\d+)?)$/, - ).test(key) + "string" === typeof key && + RegExp(/^value_[+-]?\d+(?:\.\d+)?(?:[eE][+-]?\d+)?$/).test( + key, + ) ) return "number" === typeof value && Number.isFinite(value); if ( + "string" === typeof key && RegExp( - /^(between_(.*)_and_[+-]?\d+(?:\.\d+)?(?:[eE][+-]?\d+)?)$/, + /^between_(.*)_and_[+-]?\d+(?:\.\d+)?(?:[eE][+-]?\d+)?$/, ).test(key) ) return "boolean" === typeof value; diff --git a/test/generated/output/is/test_is_DynamicTree.ts b/test/generated/output/is/test_is_DynamicTree.ts index 5efe625691..02fea64b07 100644 --- a/test/generated/output/is/test_is_DynamicTree.ts +++ b/test/generated/output/is/test_is_DynamicTree.ts @@ -18,7 +18,7 @@ export const test_is_DynamicTree = _test_is("DynamicTree")( Object.keys(input).every((key: any) => { const value = input[key]; if (undefined === value) return true; - if (RegExp(/(.*)/).test(key)) + if (true) return ( "object" === typeof value && null !== value && diff --git a/test/generated/output/is/test_is_DynamicUndefined.ts b/test/generated/output/is/test_is_DynamicUndefined.ts index c39baee398..3ab5c72fec 100644 --- a/test/generated/output/is/test_is_DynamicUndefined.ts +++ b/test/generated/output/is/test_is_DynamicUndefined.ts @@ -10,8 +10,7 @@ export const test_is_DynamicUndefined = _test_is( Object.keys(input).every((key: any) => { const value = input[key]; if (undefined === value) return true; - if (RegExp(/(.*)/).test(key)) - return null !== value && undefined === value; + if (true) return null !== value && undefined === value; return true; }); return ( diff --git a/test/generated/output/is/test_is_DynamicUnion.ts b/test/generated/output/is/test_is_DynamicUnion.ts index cd84b0531a..c37d797fec 100644 --- a/test/generated/output/is/test_is_DynamicUnion.ts +++ b/test/generated/output/is/test_is_DynamicUnion.ts @@ -10,15 +10,22 @@ export const test_is_DynamicUnion = _test_is("DynamicUnion")( Object.keys(input).every((key: any) => { const value = input[key]; if (undefined === value) return true; - if (RegExp(/^[+-]?\d+(?:\.\d+)?(?:[eE][+-]?\d+)?$/).test(key)) + if ( + "number" === typeof Number(key) && + Number.isFinite(Number(key)) + ) return "string" === typeof value; - if (RegExp(/^(prefix_(.*))/).test(key)) + if ("string" === typeof key && RegExp(/^prefix_(.*)/).test(key)) return "string" === typeof value; - if (RegExp(/((.*)_postfix)$/).test(key)) + if ( + "string" === typeof key && + RegExp(/(.*)_postfix$/).test(key) + ) return "string" === typeof value; if ( + "string" === typeof key && RegExp( - /^(value_between_[+-]?\d+(?:\.\d+)?(?:[eE][+-]?\d+)?_and_[+-]?\d+(?:\.\d+)?(?:[eE][+-]?\d+)?)$/, + /^value_between_[+-]?\d+(?:\.\d+)?(?:[eE][+-]?\d+)?_and_[+-]?\d+(?:\.\d+)?(?:[eE][+-]?\d+)?$/, ).test(key) ) return "number" === typeof value && Number.isFinite(value); diff --git a/test/generated/output/is/test_is_ObjectDynamic.ts b/test/generated/output/is/test_is_ObjectDynamic.ts index 50f4104a2d..bcd82f89bc 100644 --- a/test/generated/output/is/test_is_ObjectDynamic.ts +++ b/test/generated/output/is/test_is_ObjectDynamic.ts @@ -10,7 +10,7 @@ export const test_is_ObjectDynamic = _test_is("ObjectDynamic")( Object.keys(input).every((key: any) => { const value = input[key]; if (undefined === value) return true; - if (RegExp(/(.*)/).test(key)) + if (true) return ( "string" === typeof value || ("number" === typeof value && Number.isFinite(value)) || diff --git a/test/generated/output/is/test_is_UltimateUnion.ts b/test/generated/output/is/test_is_UltimateUnion.ts index d1d54b1265..2152cfbbc5 100644 --- a/test/generated/output/is/test_is_UltimateUnion.ts +++ b/test/generated/output/is/test_is_UltimateUnion.ts @@ -497,7 +497,7 @@ export const test_is_UltimateUnion = _test_is("UltimateUnion")( Object.keys(input).every((key: any) => { const value = input[key]; if (undefined === value) return true; - if (RegExp(/(.*)/).test(key)) + if (true) return ( "object" === typeof value && null !== value && @@ -556,7 +556,7 @@ export const test_is_UltimateUnion = _test_is("UltimateUnion")( Object.keys(input).every((key: any) => { const value = input[key]; if (undefined === value) return true; - if (RegExp(/(.*)/).test(key)) + if (true) return ( "object" === typeof value && null !== value && diff --git a/test/generated/output/issues/test_issue_831_optional.ts b/test/generated/output/issues/test_issue_831_optional.ts index 9efb6c1c90..022ba0d4fb 100644 --- a/test/generated/output/issues/test_issue_831_optional.ts +++ b/test/generated/output/issues/test_issue_831_optional.ts @@ -172,7 +172,7 @@ export const test_issue_831_optional = () => { Object.keys(input).every((key: any) => { const value = input[key]; if (undefined === value) return true; - if (RegExp(/(.*)/).test(key)) + if (true) return ( "object" === typeof value && null !== value && @@ -946,7 +946,7 @@ export const test_issue_831_optional = () => { Object.keys(input).every((key: any) => { const value = input[key]; if (undefined === value) return true; - if (RegExp(/(.*)/).test(key)) + if (true) return ( ((("object" === typeof value && null !== value && diff --git a/test/generated/output/json.assertParse/test_json_assertParse_DynamicComposite.ts b/test/generated/output/json.assertParse/test_json_assertParse_DynamicComposite.ts index 8f0db58b4d..1881f96a47 100644 --- a/test/generated/output/json.assertParse/test_json_assertParse_DynamicComposite.ts +++ b/test/generated/output/json.assertParse/test_json_assertParse_DynamicComposite.ts @@ -17,21 +17,27 @@ export const test_json_assertParse_DynamicComposite = _test_json_assertParse( const value = input[key]; if (undefined === value) return true; if ( - RegExp( - /^[+-]?\d+(?:\.\d+)?(?:[eE][+-]?\d+)?$/, - ).test(key) + "number" === typeof Number(key) && + Number.isFinite(Number(key)) ) return ( "number" === typeof value && Number.isFinite(value) ); - if (RegExp(/^(prefix_(.*))/).test(key)) + if ( + "string" === typeof key && + RegExp(/^prefix_(.*)/).test(key) + ) return "string" === typeof value; - if (RegExp(/((.*)_postfix)$/).test(key)) + if ( + "string" === typeof key && + RegExp(/(.*)_postfix$/).test(key) + ) return "string" === typeof value; if ( + "string" === typeof key && RegExp( - /^(value_[+-]?\d+(?:\.\d+)?(?:[eE][+-]?\d+)?)$/, + /^value_[+-]?\d+(?:\.\d+)?(?:[eE][+-]?\d+)?$/, ).test(key) ) return ( @@ -41,8 +47,9 @@ export const test_json_assertParse_DynamicComposite = _test_json_assertParse( "boolean" === typeof value ); if ( + "string" === typeof key && RegExp( - /^(between_(.*)_and_[+-]?\d+(?:\.\d+)?(?:[eE][+-]?\d+)?)$/, + /^between_(.*)_and_[+-]?\d+(?:\.\d+)?(?:[eE][+-]?\d+)?$/, ).test(key) ) return "boolean" === typeof value; @@ -88,9 +95,8 @@ export const test_json_assertParse_DynamicComposite = _test_json_assertParse( const value = input[key]; if (undefined === value) return true; if ( - RegExp( - /^[+-]?\d+(?:\.\d+)?(?:[eE][+-]?\d+)?$/, - ).test(key) + "number" === typeof Number(key) && + Number.isFinite(Number(key)) ) return ( ("number" === typeof value && @@ -101,7 +107,10 @@ export const test_json_assertParse_DynamicComposite = _test_json_assertParse( value: value, }) ); - if (RegExp(/^(prefix_(.*))/).test(key)) + if ( + "string" === typeof key && + RegExp(/^prefix_(.*)/).test(key) + ) return ( "string" === typeof value || $guard(_exceptionable, { @@ -110,7 +119,10 @@ export const test_json_assertParse_DynamicComposite = _test_json_assertParse( value: value, }) ); - if (RegExp(/((.*)_postfix)$/).test(key)) + if ( + "string" === typeof key && + RegExp(/(.*)_postfix$/).test(key) + ) return ( "string" === typeof value || $guard(_exceptionable, { @@ -120,8 +132,9 @@ export const test_json_assertParse_DynamicComposite = _test_json_assertParse( }) ); if ( + "string" === typeof key && RegExp( - /^(value_[+-]?\d+(?:\.\d+)?(?:[eE][+-]?\d+)?)$/, + /^value_[+-]?\d+(?:\.\d+)?(?:[eE][+-]?\d+)?$/, ).test(key) ) return ( @@ -137,8 +150,9 @@ export const test_json_assertParse_DynamicComposite = _test_json_assertParse( }) ); if ( + "string" === typeof key && RegExp( - /^(between_(.*)_and_[+-]?\d+(?:\.\d+)?(?:[eE][+-]?\d+)?)$/, + /^between_(.*)_and_[+-]?\d+(?:\.\d+)?(?:[eE][+-]?\d+)?$/, ).test(key) ) return ( diff --git a/test/generated/output/json.assertParse/test_json_assertParse_DynamicNever.ts b/test/generated/output/json.assertParse/test_json_assertParse_DynamicNever.ts index ca7565503f..06d075fe87 100644 --- a/test/generated/output/json.assertParse/test_json_assertParse_DynamicNever.ts +++ b/test/generated/output/json.assertParse/test_json_assertParse_DynamicNever.ts @@ -12,8 +12,7 @@ export const test_json_assertParse_DynamicNever = _test_json_assertParse( Object.keys(input).every((key: any) => { const value = input[key]; if (undefined === value) return true; - if (RegExp(/(.*)/).test(key)) - return null !== value && undefined === value; + if (true) return null !== value && undefined === value; return true; }); return ( @@ -40,7 +39,7 @@ export const test_json_assertParse_DynamicNever = _test_json_assertParse( Object.keys(input).every((key: any) => { const value = input[key]; if (undefined === value) return true; - if (RegExp(/(.*)/).test(key)) + if (true) return ( (null !== value || $guard(_exceptionable, { diff --git a/test/generated/output/json.assertParse/test_json_assertParse_DynamicTemplate.ts b/test/generated/output/json.assertParse/test_json_assertParse_DynamicTemplate.ts index 7672fa0d81..c4e6339c71 100644 --- a/test/generated/output/json.assertParse/test_json_assertParse_DynamicTemplate.ts +++ b/test/generated/output/json.assertParse/test_json_assertParse_DynamicTemplate.ts @@ -12,13 +12,20 @@ export const test_json_assertParse_DynamicTemplate = _test_json_assertParse( Object.keys(input).every((key: any) => { const value = input[key]; if (undefined === value) return true; - if (RegExp(/^(prefix_(.*))/).test(key)) + if ( + "string" === typeof key && + RegExp(/^prefix_(.*)/).test(key) + ) return "string" === typeof value; - if (RegExp(/((.*)_postfix)$/).test(key)) + if ( + "string" === typeof key && + RegExp(/(.*)_postfix$/).test(key) + ) return "string" === typeof value; if ( + "string" === typeof key && RegExp( - /^(value_[+-]?\d+(?:\.\d+)?(?:[eE][+-]?\d+)?)$/, + /^value_[+-]?\d+(?:\.\d+)?(?:[eE][+-]?\d+)?$/, ).test(key) ) return ( @@ -26,8 +33,9 @@ export const test_json_assertParse_DynamicTemplate = _test_json_assertParse( Number.isFinite(value) ); if ( + "string" === typeof key && RegExp( - /^(between_(.*)_and_[+-]?\d+(?:\.\d+)?(?:[eE][+-]?\d+)?)$/, + /^between_(.*)_and_[+-]?\d+(?:\.\d+)?(?:[eE][+-]?\d+)?$/, ).test(key) ) return "boolean" === typeof value; @@ -57,7 +65,10 @@ export const test_json_assertParse_DynamicTemplate = _test_json_assertParse( Object.keys(input).every((key: any) => { const value = input[key]; if (undefined === value) return true; - if (RegExp(/^(prefix_(.*))/).test(key)) + if ( + "string" === typeof key && + RegExp(/^prefix_(.*)/).test(key) + ) return ( "string" === typeof value || $guard(_exceptionable, { @@ -66,7 +77,10 @@ export const test_json_assertParse_DynamicTemplate = _test_json_assertParse( value: value, }) ); - if (RegExp(/((.*)_postfix)$/).test(key)) + if ( + "string" === typeof key && + RegExp(/(.*)_postfix$/).test(key) + ) return ( "string" === typeof value || $guard(_exceptionable, { @@ -76,8 +90,9 @@ export const test_json_assertParse_DynamicTemplate = _test_json_assertParse( }) ); if ( + "string" === typeof key && RegExp( - /^(value_[+-]?\d+(?:\.\d+)?(?:[eE][+-]?\d+)?)$/, + /^value_[+-]?\d+(?:\.\d+)?(?:[eE][+-]?\d+)?$/, ).test(key) ) return ( @@ -90,8 +105,9 @@ export const test_json_assertParse_DynamicTemplate = _test_json_assertParse( }) ); if ( + "string" === typeof key && RegExp( - /^(between_(.*)_and_[+-]?\d+(?:\.\d+)?(?:[eE][+-]?\d+)?)$/, + /^between_(.*)_and_[+-]?\d+(?:\.\d+)?(?:[eE][+-]?\d+)?$/, ).test(key) ) return ( diff --git a/test/generated/output/json.assertParse/test_json_assertParse_DynamicTree.ts b/test/generated/output/json.assertParse/test_json_assertParse_DynamicTree.ts index cc5589a928..83e21d2c2b 100644 --- a/test/generated/output/json.assertParse/test_json_assertParse_DynamicTree.ts +++ b/test/generated/output/json.assertParse/test_json_assertParse_DynamicTree.ts @@ -20,7 +20,7 @@ export const test_json_assertParse_DynamicTree = _test_json_assertParse( Object.keys(input).every((key: any) => { const value = input[key]; if (undefined === value) return true; - if (RegExp(/(.*)/).test(key)) + if (true) return ( "object" === typeof value && null !== value && @@ -85,7 +85,7 @@ export const test_json_assertParse_DynamicTree = _test_json_assertParse( Object.keys(input).every((key: any) => { const value = input[key]; if (undefined === value) return true; - if (RegExp(/(.*)/).test(key)) + if (true) return ( ((("object" === typeof value && null !== value) || diff --git a/test/generated/output/json.assertParse/test_json_assertParse_DynamicUndefined.ts b/test/generated/output/json.assertParse/test_json_assertParse_DynamicUndefined.ts index 01419ec1f2..a58dd5a353 100644 --- a/test/generated/output/json.assertParse/test_json_assertParse_DynamicUndefined.ts +++ b/test/generated/output/json.assertParse/test_json_assertParse_DynamicUndefined.ts @@ -12,8 +12,7 @@ export const test_json_assertParse_DynamicUndefined = _test_json_assertParse( Object.keys(input).every((key: any) => { const value = input[key]; if (undefined === value) return true; - if (RegExp(/(.*)/).test(key)) - return null !== value && undefined === value; + if (true) return null !== value && undefined === value; return true; }); return ( @@ -40,7 +39,7 @@ export const test_json_assertParse_DynamicUndefined = _test_json_assertParse( Object.keys(input).every((key: any) => { const value = input[key]; if (undefined === value) return true; - if (RegExp(/(.*)/).test(key)) + if (true) return ( (null !== value || $guard(_exceptionable, { diff --git a/test/generated/output/json.assertParse/test_json_assertParse_DynamicUnion.ts b/test/generated/output/json.assertParse/test_json_assertParse_DynamicUnion.ts index 5825848b0c..b59539d44d 100644 --- a/test/generated/output/json.assertParse/test_json_assertParse_DynamicUnion.ts +++ b/test/generated/output/json.assertParse/test_json_assertParse_DynamicUnion.ts @@ -13,18 +13,24 @@ export const test_json_assertParse_DynamicUnion = _test_json_assertParse( const value = input[key]; if (undefined === value) return true; if ( - RegExp( - /^[+-]?\d+(?:\.\d+)?(?:[eE][+-]?\d+)?$/, - ).test(key) + "number" === typeof Number(key) && + Number.isFinite(Number(key)) ) return "string" === typeof value; - if (RegExp(/^(prefix_(.*))/).test(key)) + if ( + "string" === typeof key && + RegExp(/^prefix_(.*)/).test(key) + ) return "string" === typeof value; - if (RegExp(/((.*)_postfix)$/).test(key)) + if ( + "string" === typeof key && + RegExp(/(.*)_postfix$/).test(key) + ) return "string" === typeof value; if ( + "string" === typeof key && RegExp( - /^(value_between_[+-]?\d+(?:\.\d+)?(?:[eE][+-]?\d+)?_and_[+-]?\d+(?:\.\d+)?(?:[eE][+-]?\d+)?)$/, + /^value_between_[+-]?\d+(?:\.\d+)?(?:[eE][+-]?\d+)?_and_[+-]?\d+(?:\.\d+)?(?:[eE][+-]?\d+)?$/, ).test(key) ) return ( @@ -58,9 +64,8 @@ export const test_json_assertParse_DynamicUnion = _test_json_assertParse( const value = input[key]; if (undefined === value) return true; if ( - RegExp( - /^[+-]?\d+(?:\.\d+)?(?:[eE][+-]?\d+)?$/, - ).test(key) + "number" === typeof Number(key) && + Number.isFinite(Number(key)) ) return ( "string" === typeof value || @@ -70,7 +75,10 @@ export const test_json_assertParse_DynamicUnion = _test_json_assertParse( value: value, }) ); - if (RegExp(/^(prefix_(.*))/).test(key)) + if ( + "string" === typeof key && + RegExp(/^prefix_(.*)/).test(key) + ) return ( "string" === typeof value || $guard(_exceptionable, { @@ -79,7 +87,10 @@ export const test_json_assertParse_DynamicUnion = _test_json_assertParse( value: value, }) ); - if (RegExp(/((.*)_postfix)$/).test(key)) + if ( + "string" === typeof key && + RegExp(/(.*)_postfix$/).test(key) + ) return ( "string" === typeof value || $guard(_exceptionable, { @@ -89,8 +100,9 @@ export const test_json_assertParse_DynamicUnion = _test_json_assertParse( }) ); if ( + "string" === typeof key && RegExp( - /^(value_between_[+-]?\d+(?:\.\d+)?(?:[eE][+-]?\d+)?_and_[+-]?\d+(?:\.\d+)?(?:[eE][+-]?\d+)?)$/, + /^value_between_[+-]?\d+(?:\.\d+)?(?:[eE][+-]?\d+)?_and_[+-]?\d+(?:\.\d+)?(?:[eE][+-]?\d+)?$/, ).test(key) ) return ( diff --git a/test/generated/output/json.assertParse/test_json_assertParse_ObjectDynamic.ts b/test/generated/output/json.assertParse/test_json_assertParse_ObjectDynamic.ts index 0ebf25c65f..1c5bb7c846 100644 --- a/test/generated/output/json.assertParse/test_json_assertParse_ObjectDynamic.ts +++ b/test/generated/output/json.assertParse/test_json_assertParse_ObjectDynamic.ts @@ -12,7 +12,7 @@ export const test_json_assertParse_ObjectDynamic = _test_json_assertParse( Object.keys(input).every((key: any) => { const value = input[key]; if (undefined === value) return true; - if (RegExp(/(.*)/).test(key)) + if (true) return ( "string" === typeof value || ("number" === typeof value && @@ -45,7 +45,7 @@ export const test_json_assertParse_ObjectDynamic = _test_json_assertParse( Object.keys(input).every((key: any) => { const value = input[key]; if (undefined === value) return true; - if (RegExp(/(.*)/).test(key)) + if (true) return ( "string" === typeof value || ("number" === typeof value && diff --git a/test/generated/output/json.assertParse/test_json_assertParse_UltimateUnion.ts b/test/generated/output/json.assertParse/test_json_assertParse_UltimateUnion.ts index 5aadba48f2..25654f406e 100644 --- a/test/generated/output/json.assertParse/test_json_assertParse_UltimateUnion.ts +++ b/test/generated/output/json.assertParse/test_json_assertParse_UltimateUnion.ts @@ -518,7 +518,7 @@ export const test_json_assertParse_UltimateUnion = _test_json_assertParse( Object.keys(input).every((key: any) => { const value = input[key]; if (undefined === value) return true; - if (RegExp(/(.*)/).test(key)) + if (true) return ( "object" === typeof value && null !== value && @@ -585,7 +585,7 @@ export const test_json_assertParse_UltimateUnion = _test_json_assertParse( Object.keys(input).every((key: any) => { const value = input[key]; if (undefined === value) return true; - if (RegExp(/(.*)/).test(key)) + if (true) return ( "object" === typeof value && null !== value && @@ -3393,7 +3393,7 @@ export const test_json_assertParse_UltimateUnion = _test_json_assertParse( Object.keys(input).every((key: any) => { const value = input[key]; if (undefined === value) return true; - if (RegExp(/(.*)/).test(key)) + if (true) return ( ((("object" === typeof value && null !== value && @@ -3649,7 +3649,7 @@ export const test_json_assertParse_UltimateUnion = _test_json_assertParse( Object.keys(input).every((key: any) => { const value = input[key]; if (undefined === value) return true; - if (RegExp(/(.*)/).test(key)) + if (true) return ( ((("object" === typeof value && null !== value && diff --git a/test/generated/output/json.assertStringify/test_json_assertStringify_DynamicComposite.ts b/test/generated/output/json.assertStringify/test_json_assertStringify_DynamicComposite.ts index e0378b36f9..678682a6f4 100644 --- a/test/generated/output/json.assertStringify/test_json_assertStringify_DynamicComposite.ts +++ b/test/generated/output/json.assertStringify/test_json_assertStringify_DynamicComposite.ts @@ -20,21 +20,27 @@ export const test_json_assertStringify_DynamicComposite = const value = input[key]; if (undefined === value) return true; if ( - RegExp( - /^[+-]?\d+(?:\.\d+)?(?:[eE][+-]?\d+)?$/, - ).test(key) + "number" === typeof Number(key) && + Number.isFinite(Number(key)) ) return ( "number" === typeof value && Number.isFinite(value) ); - if (RegExp(/^(prefix_(.*))/).test(key)) + if ( + "string" === typeof key && + RegExp(/^prefix_(.*)/).test(key) + ) return "string" === typeof value; - if (RegExp(/((.*)_postfix)$/).test(key)) + if ( + "string" === typeof key && + RegExp(/(.*)_postfix$/).test(key) + ) return "string" === typeof value; if ( + "string" === typeof key && RegExp( - /^(value_[+-]?\d+(?:\.\d+)?(?:[eE][+-]?\d+)?)$/, + /^value_[+-]?\d+(?:\.\d+)?(?:[eE][+-]?\d+)?$/, ).test(key) ) return ( @@ -44,8 +50,9 @@ export const test_json_assertStringify_DynamicComposite = "boolean" === typeof value ); if ( + "string" === typeof key && RegExp( - /^(between_(.*)_and_[+-]?\d+(?:\.\d+)?(?:[eE][+-]?\d+)?)$/, + /^between_(.*)_and_[+-]?\d+(?:\.\d+)?(?:[eE][+-]?\d+)?$/, ).test(key) ) return "boolean" === typeof value; @@ -94,9 +101,8 @@ export const test_json_assertStringify_DynamicComposite = const value = input[key]; if (undefined === value) return true; if ( - RegExp( - /^[+-]?\d+(?:\.\d+)?(?:[eE][+-]?\d+)?$/, - ).test(key) + "number" === typeof Number(key) && + Number.isFinite(Number(key)) ) return ( ("number" === typeof value && @@ -107,7 +113,10 @@ export const test_json_assertStringify_DynamicComposite = value: value, }) ); - if (RegExp(/^(prefix_(.*))/).test(key)) + if ( + "string" === typeof key && + RegExp(/^prefix_(.*)/).test(key) + ) return ( "string" === typeof value || $guard(_exceptionable, { @@ -116,7 +125,10 @@ export const test_json_assertStringify_DynamicComposite = value: value, }) ); - if (RegExp(/((.*)_postfix)$/).test(key)) + if ( + "string" === typeof key && + RegExp(/(.*)_postfix$/).test(key) + ) return ( "string" === typeof value || $guard(_exceptionable, { @@ -126,8 +138,9 @@ export const test_json_assertStringify_DynamicComposite = }) ); if ( + "string" === typeof key && RegExp( - /^(value_[+-]?\d+(?:\.\d+)?(?:[eE][+-]?\d+)?)$/, + /^value_[+-]?\d+(?:\.\d+)?(?:[eE][+-]?\d+)?$/, ).test(key) ) return ( @@ -143,8 +156,9 @@ export const test_json_assertStringify_DynamicComposite = }) ); if ( + "string" === typeof key && RegExp( - /^(between_(.*)_and_[+-]?\d+(?:\.\d+)?(?:[eE][+-]?\d+)?)$/, + /^between_(.*)_and_[+-]?\d+(?:\.\d+)?(?:[eE][+-]?\d+)?$/, ).test(key) ) return ( diff --git a/test/generated/output/json.assertStringify/test_json_assertStringify_DynamicNever.ts b/test/generated/output/json.assertStringify/test_json_assertStringify_DynamicNever.ts index 9c082e1b2a..8dee8f6ea7 100644 --- a/test/generated/output/json.assertStringify/test_json_assertStringify_DynamicNever.ts +++ b/test/generated/output/json.assertStringify/test_json_assertStringify_DynamicNever.ts @@ -12,7 +12,7 @@ export const test_json_assertStringify_DynamicNever = Object.keys(input).every((key: any) => { const value = input[key]; if (undefined === value) return true; - if (RegExp(/(.*)/).test(key)) + if (true) return ( null !== value && undefined === value ); @@ -44,7 +44,7 @@ export const test_json_assertStringify_DynamicNever = Object.keys(input).every((key: any) => { const value = input[key]; if (undefined === value) return true; - if (RegExp(/(.*)/).test(key)) + if (true) return ( (null !== value || $guard(_exceptionable, { diff --git a/test/generated/output/json.assertStringify/test_json_assertStringify_DynamicTemplate.ts b/test/generated/output/json.assertStringify/test_json_assertStringify_DynamicTemplate.ts index 5716f479c4..274772cfd7 100644 --- a/test/generated/output/json.assertStringify/test_json_assertStringify_DynamicTemplate.ts +++ b/test/generated/output/json.assertStringify/test_json_assertStringify_DynamicTemplate.ts @@ -13,13 +13,20 @@ export const test_json_assertStringify_DynamicTemplate = Object.keys(input).every((key: any) => { const value = input[key]; if (undefined === value) return true; - if (RegExp(/^(prefix_(.*))/).test(key)) + if ( + "string" === typeof key && + RegExp(/^prefix_(.*)/).test(key) + ) return "string" === typeof value; - if (RegExp(/((.*)_postfix)$/).test(key)) + if ( + "string" === typeof key && + RegExp(/(.*)_postfix$/).test(key) + ) return "string" === typeof value; if ( + "string" === typeof key && RegExp( - /^(value_[+-]?\d+(?:\.\d+)?(?:[eE][+-]?\d+)?)$/, + /^value_[+-]?\d+(?:\.\d+)?(?:[eE][+-]?\d+)?$/, ).test(key) ) return ( @@ -27,8 +34,9 @@ export const test_json_assertStringify_DynamicTemplate = Number.isFinite(value) ); if ( + "string" === typeof key && RegExp( - /^(between_(.*)_and_[+-]?\d+(?:\.\d+)?(?:[eE][+-]?\d+)?)$/, + /^between_(.*)_and_[+-]?\d+(?:\.\d+)?(?:[eE][+-]?\d+)?$/, ).test(key) ) return "boolean" === typeof value; @@ -59,7 +67,10 @@ export const test_json_assertStringify_DynamicTemplate = Object.keys(input).every((key: any) => { const value = input[key]; if (undefined === value) return true; - if (RegExp(/^(prefix_(.*))/).test(key)) + if ( + "string" === typeof key && + RegExp(/^prefix_(.*)/).test(key) + ) return ( "string" === typeof value || $guard(_exceptionable, { @@ -68,7 +79,10 @@ export const test_json_assertStringify_DynamicTemplate = value: value, }) ); - if (RegExp(/((.*)_postfix)$/).test(key)) + if ( + "string" === typeof key && + RegExp(/(.*)_postfix$/).test(key) + ) return ( "string" === typeof value || $guard(_exceptionable, { @@ -78,8 +92,9 @@ export const test_json_assertStringify_DynamicTemplate = }) ); if ( + "string" === typeof key && RegExp( - /^(value_[+-]?\d+(?:\.\d+)?(?:[eE][+-]?\d+)?)$/, + /^value_[+-]?\d+(?:\.\d+)?(?:[eE][+-]?\d+)?$/, ).test(key) ) return ( @@ -92,8 +107,9 @@ export const test_json_assertStringify_DynamicTemplate = }) ); if ( + "string" === typeof key && RegExp( - /^(between_(.*)_and_[+-]?\d+(?:\.\d+)?(?:[eE][+-]?\d+)?)$/, + /^between_(.*)_and_[+-]?\d+(?:\.\d+)?(?:[eE][+-]?\d+)?$/, ).test(key) ) return ( diff --git a/test/generated/output/json.assertStringify/test_json_assertStringify_DynamicTree.ts b/test/generated/output/json.assertStringify/test_json_assertStringify_DynamicTree.ts index 638d121963..5720e0ecf6 100644 --- a/test/generated/output/json.assertStringify/test_json_assertStringify_DynamicTree.ts +++ b/test/generated/output/json.assertStringify/test_json_assertStringify_DynamicTree.ts @@ -20,7 +20,7 @@ export const test_json_assertStringify_DynamicTree = _test_json_assertStringify( Object.keys(input).every((key: any) => { const value = input[key]; if (undefined === value) return true; - if (RegExp(/(.*)/).test(key)) + if (true) return ( "object" === typeof value && null !== value && @@ -85,7 +85,7 @@ export const test_json_assertStringify_DynamicTree = _test_json_assertStringify( Object.keys(input).every((key: any) => { const value = input[key]; if (undefined === value) return true; - if (RegExp(/(.*)/).test(key)) + if (true) return ( ((("object" === typeof value && null !== value) || @@ -136,7 +136,7 @@ export const test_json_assertStringify_DynamicTree = _test_json_assertStringify( Object.keys(input).every((key: any) => { const value = input[key]; if (undefined === value) return true; - if (RegExp(/(.*)/).test(key)) + if (true) return ( "object" === typeof value && null !== value && diff --git a/test/generated/output/json.assertStringify/test_json_assertStringify_DynamicUndefined.ts b/test/generated/output/json.assertStringify/test_json_assertStringify_DynamicUndefined.ts index 6dff681a93..b96906555f 100644 --- a/test/generated/output/json.assertStringify/test_json_assertStringify_DynamicUndefined.ts +++ b/test/generated/output/json.assertStringify/test_json_assertStringify_DynamicUndefined.ts @@ -13,7 +13,7 @@ export const test_json_assertStringify_DynamicUndefined = Object.keys(input).every((key: any) => { const value = input[key]; if (undefined === value) return true; - if (RegExp(/(.*)/).test(key)) + if (true) return null !== value && undefined === value; return true; }); @@ -42,7 +42,7 @@ export const test_json_assertStringify_DynamicUndefined = Object.keys(input).every((key: any) => { const value = input[key]; if (undefined === value) return true; - if (RegExp(/(.*)/).test(key)) + if (true) return ( (null !== value || $guard(_exceptionable, { diff --git a/test/generated/output/json.assertStringify/test_json_assertStringify_DynamicUnion.ts b/test/generated/output/json.assertStringify/test_json_assertStringify_DynamicUnion.ts index 762b38fb27..5910561e0e 100644 --- a/test/generated/output/json.assertStringify/test_json_assertStringify_DynamicUnion.ts +++ b/test/generated/output/json.assertStringify/test_json_assertStringify_DynamicUnion.ts @@ -13,18 +13,24 @@ export const test_json_assertStringify_DynamicUnion = const value = input[key]; if (undefined === value) return true; if ( - RegExp( - /^[+-]?\d+(?:\.\d+)?(?:[eE][+-]?\d+)?$/, - ).test(key) + "number" === typeof Number(key) && + Number.isFinite(Number(key)) ) return "string" === typeof value; - if (RegExp(/^(prefix_(.*))/).test(key)) + if ( + "string" === typeof key && + RegExp(/^prefix_(.*)/).test(key) + ) return "string" === typeof value; - if (RegExp(/((.*)_postfix)$/).test(key)) + if ( + "string" === typeof key && + RegExp(/(.*)_postfix$/).test(key) + ) return "string" === typeof value; if ( + "string" === typeof key && RegExp( - /^(value_between_[+-]?\d+(?:\.\d+)?(?:[eE][+-]?\d+)?_and_[+-]?\d+(?:\.\d+)?(?:[eE][+-]?\d+)?)$/, + /^value_between_[+-]?\d+(?:\.\d+)?(?:[eE][+-]?\d+)?_and_[+-]?\d+(?:\.\d+)?(?:[eE][+-]?\d+)?$/, ).test(key) ) return ( @@ -60,9 +66,8 @@ export const test_json_assertStringify_DynamicUnion = const value = input[key]; if (undefined === value) return true; if ( - RegExp( - /^[+-]?\d+(?:\.\d+)?(?:[eE][+-]?\d+)?$/, - ).test(key) + "number" === typeof Number(key) && + Number.isFinite(Number(key)) ) return ( "string" === typeof value || @@ -72,7 +77,10 @@ export const test_json_assertStringify_DynamicUnion = value: value, }) ); - if (RegExp(/^(prefix_(.*))/).test(key)) + if ( + "string" === typeof key && + RegExp(/^prefix_(.*)/).test(key) + ) return ( "string" === typeof value || $guard(_exceptionable, { @@ -81,7 +89,10 @@ export const test_json_assertStringify_DynamicUnion = value: value, }) ); - if (RegExp(/((.*)_postfix)$/).test(key)) + if ( + "string" === typeof key && + RegExp(/(.*)_postfix$/).test(key) + ) return ( "string" === typeof value || $guard(_exceptionable, { @@ -91,8 +102,9 @@ export const test_json_assertStringify_DynamicUnion = }) ); if ( + "string" === typeof key && RegExp( - /^(value_between_[+-]?\d+(?:\.\d+)?(?:[eE][+-]?\d+)?_and_[+-]?\d+(?:\.\d+)?(?:[eE][+-]?\d+)?)$/, + /^value_between_[+-]?\d+(?:\.\d+)?(?:[eE][+-]?\d+)?_and_[+-]?\d+(?:\.\d+)?(?:[eE][+-]?\d+)?$/, ).test(key) ) return ( diff --git a/test/generated/output/json.assertStringify/test_json_assertStringify_ObjectDynamic.ts b/test/generated/output/json.assertStringify/test_json_assertStringify_ObjectDynamic.ts index fd66fab421..9cb73cc83b 100644 --- a/test/generated/output/json.assertStringify/test_json_assertStringify_ObjectDynamic.ts +++ b/test/generated/output/json.assertStringify/test_json_assertStringify_ObjectDynamic.ts @@ -12,7 +12,7 @@ export const test_json_assertStringify_ObjectDynamic = Object.keys(input).every((key: any) => { const value = input[key]; if (undefined === value) return true; - if (RegExp(/(.*)/).test(key)) + if (true) return ( "string" === typeof value || ("number" === typeof value && @@ -47,7 +47,7 @@ export const test_json_assertStringify_ObjectDynamic = Object.keys(input).every((key: any) => { const value = input[key]; if (undefined === value) return true; - if (RegExp(/(.*)/).test(key)) + if (true) return ( "string" === typeof value || ("number" === typeof value && diff --git a/test/generated/output/json.assertStringify/test_json_assertStringify_UltimateUnion.ts b/test/generated/output/json.assertStringify/test_json_assertStringify_UltimateUnion.ts index df6523ad33..dad268211f 100644 --- a/test/generated/output/json.assertStringify/test_json_assertStringify_UltimateUnion.ts +++ b/test/generated/output/json.assertStringify/test_json_assertStringify_UltimateUnion.ts @@ -554,7 +554,7 @@ export const test_json_assertStringify_UltimateUnion = Object.keys(input).every((key: any) => { const value = input[key]; if (undefined === value) return true; - if (RegExp(/(.*)/).test(key)) + if (true) return ( "object" === typeof value && null !== value && @@ -638,7 +638,7 @@ export const test_json_assertStringify_UltimateUnion = Object.keys(input).every((key: any) => { const value = input[key]; if (undefined === value) return true; - if (RegExp(/(.*)/).test(key)) + if (true) return ( "object" === typeof value && null !== value && @@ -3679,7 +3679,7 @@ export const test_json_assertStringify_UltimateUnion = Object.keys(input).every((key: any) => { const value = input[key]; if (undefined === value) return true; - if (RegExp(/(.*)/).test(key)) + if (true) return ( ((("object" === typeof value && null !== value && @@ -3977,7 +3977,7 @@ export const test_json_assertStringify_UltimateUnion = Object.keys(input).every((key: any) => { const value = input[key]; if (undefined === value) return true; - if (RegExp(/(.*)/).test(key)) + if (true) return ( ((("object" === typeof value && null !== value && @@ -7078,7 +7078,7 @@ export const test_json_assertStringify_UltimateUnion = Object.keys(input).every((key: any) => { const value = input[key]; if (undefined === value) return true; - if (RegExp(/(.*)/).test(key)) + if (true) return ( "object" === typeof value && null !== value && @@ -7147,7 +7147,7 @@ export const test_json_assertStringify_UltimateUnion = Object.keys(input).every((key: any) => { const value = input[key]; if (undefined === value) return true; - if (RegExp(/(.*)/).test(key)) + if (true) return ( "object" === typeof value && null !== value && diff --git a/test/generated/output/json.createAssertParse/test_json_createAssertParse_DynamicComposite.ts b/test/generated/output/json.createAssertParse/test_json_createAssertParse_DynamicComposite.ts index 63c4bdc3fe..895b69c889 100644 --- a/test/generated/output/json.createAssertParse/test_json_createAssertParse_DynamicComposite.ts +++ b/test/generated/output/json.createAssertParse/test_json_createAssertParse_DynamicComposite.ts @@ -17,21 +17,27 @@ export const test_json_createAssertParse_DynamicComposite = const value = input[key]; if (undefined === value) return true; if ( - RegExp( - /^[+-]?\d+(?:\.\d+)?(?:[eE][+-]?\d+)?$/, - ).test(key) + "number" === typeof Number(key) && + Number.isFinite(Number(key)) ) return ( "number" === typeof value && Number.isFinite(value) ); - if (RegExp(/^(prefix_(.*))/).test(key)) + if ( + "string" === typeof key && + RegExp(/^prefix_(.*)/).test(key) + ) return "string" === typeof value; - if (RegExp(/((.*)_postfix)$/).test(key)) + if ( + "string" === typeof key && + RegExp(/(.*)_postfix$/).test(key) + ) return "string" === typeof value; if ( + "string" === typeof key && RegExp( - /^(value_[+-]?\d+(?:\.\d+)?(?:[eE][+-]?\d+)?)$/, + /^value_[+-]?\d+(?:\.\d+)?(?:[eE][+-]?\d+)?$/, ).test(key) ) return ( @@ -41,8 +47,9 @@ export const test_json_createAssertParse_DynamicComposite = "boolean" === typeof value ); if ( + "string" === typeof key && RegExp( - /^(between_(.*)_and_[+-]?\d+(?:\.\d+)?(?:[eE][+-]?\d+)?)$/, + /^between_(.*)_and_[+-]?\d+(?:\.\d+)?(?:[eE][+-]?\d+)?$/, ).test(key) ) return "boolean" === typeof value; @@ -88,9 +95,8 @@ export const test_json_createAssertParse_DynamicComposite = const value = input[key]; if (undefined === value) return true; if ( - RegExp( - /^[+-]?\d+(?:\.\d+)?(?:[eE][+-]?\d+)?$/, - ).test(key) + "number" === typeof Number(key) && + Number.isFinite(Number(key)) ) return ( ("number" === typeof value && @@ -101,7 +107,10 @@ export const test_json_createAssertParse_DynamicComposite = value: value, }) ); - if (RegExp(/^(prefix_(.*))/).test(key)) + if ( + "string" === typeof key && + RegExp(/^prefix_(.*)/).test(key) + ) return ( "string" === typeof value || $guard(_exceptionable, { @@ -110,7 +119,10 @@ export const test_json_createAssertParse_DynamicComposite = value: value, }) ); - if (RegExp(/((.*)_postfix)$/).test(key)) + if ( + "string" === typeof key && + RegExp(/(.*)_postfix$/).test(key) + ) return ( "string" === typeof value || $guard(_exceptionable, { @@ -120,8 +132,9 @@ export const test_json_createAssertParse_DynamicComposite = }) ); if ( + "string" === typeof key && RegExp( - /^(value_[+-]?\d+(?:\.\d+)?(?:[eE][+-]?\d+)?)$/, + /^value_[+-]?\d+(?:\.\d+)?(?:[eE][+-]?\d+)?$/, ).test(key) ) return ( @@ -137,8 +150,9 @@ export const test_json_createAssertParse_DynamicComposite = }) ); if ( + "string" === typeof key && RegExp( - /^(between_(.*)_and_[+-]?\d+(?:\.\d+)?(?:[eE][+-]?\d+)?)$/, + /^between_(.*)_and_[+-]?\d+(?:\.\d+)?(?:[eE][+-]?\d+)?$/, ).test(key) ) return ( diff --git a/test/generated/output/json.createAssertParse/test_json_createAssertParse_DynamicNever.ts b/test/generated/output/json.createAssertParse/test_json_createAssertParse_DynamicNever.ts index b8f3b202db..5b9fe21921 100644 --- a/test/generated/output/json.createAssertParse/test_json_createAssertParse_DynamicNever.ts +++ b/test/generated/output/json.createAssertParse/test_json_createAssertParse_DynamicNever.ts @@ -12,8 +12,7 @@ export const test_json_createAssertParse_DynamicNever = _test_json_assertParse( Object.keys(input).every((key: any) => { const value = input[key]; if (undefined === value) return true; - if (RegExp(/(.*)/).test(key)) - return null !== value && undefined === value; + if (true) return null !== value && undefined === value; return true; }); return ( @@ -40,7 +39,7 @@ export const test_json_createAssertParse_DynamicNever = _test_json_assertParse( Object.keys(input).every((key: any) => { const value = input[key]; if (undefined === value) return true; - if (RegExp(/(.*)/).test(key)) + if (true) return ( (null !== value || $guard(_exceptionable, { diff --git a/test/generated/output/json.createAssertParse/test_json_createAssertParse_DynamicTemplate.ts b/test/generated/output/json.createAssertParse/test_json_createAssertParse_DynamicTemplate.ts index 5718548b82..0cce6b7907 100644 --- a/test/generated/output/json.createAssertParse/test_json_createAssertParse_DynamicTemplate.ts +++ b/test/generated/output/json.createAssertParse/test_json_createAssertParse_DynamicTemplate.ts @@ -11,13 +11,20 @@ export const test_json_createAssertParse_DynamicTemplate = Object.keys(input).every((key: any) => { const value = input[key]; if (undefined === value) return true; - if (RegExp(/^(prefix_(.*))/).test(key)) + if ( + "string" === typeof key && + RegExp(/^prefix_(.*)/).test(key) + ) return "string" === typeof value; - if (RegExp(/((.*)_postfix)$/).test(key)) + if ( + "string" === typeof key && + RegExp(/(.*)_postfix$/).test(key) + ) return "string" === typeof value; if ( + "string" === typeof key && RegExp( - /^(value_[+-]?\d+(?:\.\d+)?(?:[eE][+-]?\d+)?)$/, + /^value_[+-]?\d+(?:\.\d+)?(?:[eE][+-]?\d+)?$/, ).test(key) ) return ( @@ -25,8 +32,9 @@ export const test_json_createAssertParse_DynamicTemplate = Number.isFinite(value) ); if ( + "string" === typeof key && RegExp( - /^(between_(.*)_and_[+-]?\d+(?:\.\d+)?(?:[eE][+-]?\d+)?)$/, + /^between_(.*)_and_[+-]?\d+(?:\.\d+)?(?:[eE][+-]?\d+)?$/, ).test(key) ) return "boolean" === typeof value; @@ -58,7 +66,10 @@ export const test_json_createAssertParse_DynamicTemplate = Object.keys(input).every((key: any) => { const value = input[key]; if (undefined === value) return true; - if (RegExp(/^(prefix_(.*))/).test(key)) + if ( + "string" === typeof key && + RegExp(/^prefix_(.*)/).test(key) + ) return ( "string" === typeof value || $guard(_exceptionable, { @@ -67,7 +78,10 @@ export const test_json_createAssertParse_DynamicTemplate = value: value, }) ); - if (RegExp(/((.*)_postfix)$/).test(key)) + if ( + "string" === typeof key && + RegExp(/(.*)_postfix$/).test(key) + ) return ( "string" === typeof value || $guard(_exceptionable, { @@ -77,8 +91,9 @@ export const test_json_createAssertParse_DynamicTemplate = }) ); if ( + "string" === typeof key && RegExp( - /^(value_[+-]?\d+(?:\.\d+)?(?:[eE][+-]?\d+)?)$/, + /^value_[+-]?\d+(?:\.\d+)?(?:[eE][+-]?\d+)?$/, ).test(key) ) return ( @@ -91,8 +106,9 @@ export const test_json_createAssertParse_DynamicTemplate = }) ); if ( + "string" === typeof key && RegExp( - /^(between_(.*)_and_[+-]?\d+(?:\.\d+)?(?:[eE][+-]?\d+)?)$/, + /^between_(.*)_and_[+-]?\d+(?:\.\d+)?(?:[eE][+-]?\d+)?$/, ).test(key) ) return ( diff --git a/test/generated/output/json.createAssertParse/test_json_createAssertParse_DynamicTree.ts b/test/generated/output/json.createAssertParse/test_json_createAssertParse_DynamicTree.ts index 41c455de4b..29307a4435 100644 --- a/test/generated/output/json.createAssertParse/test_json_createAssertParse_DynamicTree.ts +++ b/test/generated/output/json.createAssertParse/test_json_createAssertParse_DynamicTree.ts @@ -19,7 +19,7 @@ export const test_json_createAssertParse_DynamicTree = _test_json_assertParse( Object.keys(input).every((key: any) => { const value = input[key]; if (undefined === value) return true; - if (RegExp(/(.*)/).test(key)) + if (true) return ( "object" === typeof value && null !== value && @@ -82,7 +82,7 @@ export const test_json_createAssertParse_DynamicTree = _test_json_assertParse( Object.keys(input).every((key: any) => { const value = input[key]; if (undefined === value) return true; - if (RegExp(/(.*)/).test(key)) + if (true) return ( ((("object" === typeof value && null !== value) || diff --git a/test/generated/output/json.createAssertParse/test_json_createAssertParse_DynamicUndefined.ts b/test/generated/output/json.createAssertParse/test_json_createAssertParse_DynamicUndefined.ts index 7d0e0a3ca0..3dffc6d4d7 100644 --- a/test/generated/output/json.createAssertParse/test_json_createAssertParse_DynamicUndefined.ts +++ b/test/generated/output/json.createAssertParse/test_json_createAssertParse_DynamicUndefined.ts @@ -12,8 +12,7 @@ export const test_json_createAssertParse_DynamicUndefined = Object.keys(input).every((key: any) => { const value = input[key]; if (undefined === value) return true; - if (RegExp(/(.*)/).test(key)) - return null !== value && undefined === value; + if (true) return null !== value && undefined === value; return true; }); return ( @@ -40,7 +39,7 @@ export const test_json_createAssertParse_DynamicUndefined = Object.keys(input).every((key: any) => { const value = input[key]; if (undefined === value) return true; - if (RegExp(/(.*)/).test(key)) + if (true) return ( (null !== value || $guard(_exceptionable, { diff --git a/test/generated/output/json.createAssertParse/test_json_createAssertParse_DynamicUnion.ts b/test/generated/output/json.createAssertParse/test_json_createAssertParse_DynamicUnion.ts index 14b1240b20..41c5f9b71c 100644 --- a/test/generated/output/json.createAssertParse/test_json_createAssertParse_DynamicUnion.ts +++ b/test/generated/output/json.createAssertParse/test_json_createAssertParse_DynamicUnion.ts @@ -13,18 +13,24 @@ export const test_json_createAssertParse_DynamicUnion = _test_json_assertParse( const value = input[key]; if (undefined === value) return true; if ( - RegExp( - /^[+-]?\d+(?:\.\d+)?(?:[eE][+-]?\d+)?$/, - ).test(key) + "number" === typeof Number(key) && + Number.isFinite(Number(key)) ) return "string" === typeof value; - if (RegExp(/^(prefix_(.*))/).test(key)) + if ( + "string" === typeof key && + RegExp(/^prefix_(.*)/).test(key) + ) return "string" === typeof value; - if (RegExp(/((.*)_postfix)$/).test(key)) + if ( + "string" === typeof key && + RegExp(/(.*)_postfix$/).test(key) + ) return "string" === typeof value; if ( + "string" === typeof key && RegExp( - /^(value_between_[+-]?\d+(?:\.\d+)?(?:[eE][+-]?\d+)?_and_[+-]?\d+(?:\.\d+)?(?:[eE][+-]?\d+)?)$/, + /^value_between_[+-]?\d+(?:\.\d+)?(?:[eE][+-]?\d+)?_and_[+-]?\d+(?:\.\d+)?(?:[eE][+-]?\d+)?$/, ).test(key) ) return ( @@ -58,9 +64,8 @@ export const test_json_createAssertParse_DynamicUnion = _test_json_assertParse( const value = input[key]; if (undefined === value) return true; if ( - RegExp( - /^[+-]?\d+(?:\.\d+)?(?:[eE][+-]?\d+)?$/, - ).test(key) + "number" === typeof Number(key) && + Number.isFinite(Number(key)) ) return ( "string" === typeof value || @@ -70,7 +75,10 @@ export const test_json_createAssertParse_DynamicUnion = _test_json_assertParse( value: value, }) ); - if (RegExp(/^(prefix_(.*))/).test(key)) + if ( + "string" === typeof key && + RegExp(/^prefix_(.*)/).test(key) + ) return ( "string" === typeof value || $guard(_exceptionable, { @@ -79,7 +87,10 @@ export const test_json_createAssertParse_DynamicUnion = _test_json_assertParse( value: value, }) ); - if (RegExp(/((.*)_postfix)$/).test(key)) + if ( + "string" === typeof key && + RegExp(/(.*)_postfix$/).test(key) + ) return ( "string" === typeof value || $guard(_exceptionable, { @@ -89,8 +100,9 @@ export const test_json_createAssertParse_DynamicUnion = _test_json_assertParse( }) ); if ( + "string" === typeof key && RegExp( - /^(value_between_[+-]?\d+(?:\.\d+)?(?:[eE][+-]?\d+)?_and_[+-]?\d+(?:\.\d+)?(?:[eE][+-]?\d+)?)$/, + /^value_between_[+-]?\d+(?:\.\d+)?(?:[eE][+-]?\d+)?_and_[+-]?\d+(?:\.\d+)?(?:[eE][+-]?\d+)?$/, ).test(key) ) return ( diff --git a/test/generated/output/json.createAssertParse/test_json_createAssertParse_ObjectDynamic.ts b/test/generated/output/json.createAssertParse/test_json_createAssertParse_ObjectDynamic.ts index c6616ec181..882aeb508c 100644 --- a/test/generated/output/json.createAssertParse/test_json_createAssertParse_ObjectDynamic.ts +++ b/test/generated/output/json.createAssertParse/test_json_createAssertParse_ObjectDynamic.ts @@ -12,7 +12,7 @@ export const test_json_createAssertParse_ObjectDynamic = _test_json_assertParse( Object.keys(input).every((key: any) => { const value = input[key]; if (undefined === value) return true; - if (RegExp(/(.*)/).test(key)) + if (true) return ( "string" === typeof value || ("number" === typeof value && @@ -45,7 +45,7 @@ export const test_json_createAssertParse_ObjectDynamic = _test_json_assertParse( Object.keys(input).every((key: any) => { const value = input[key]; if (undefined === value) return true; - if (RegExp(/(.*)/).test(key)) + if (true) return ( "string" === typeof value || ("number" === typeof value && diff --git a/test/generated/output/json.createAssertParse/test_json_createAssertParse_UltimateUnion.ts b/test/generated/output/json.createAssertParse/test_json_createAssertParse_UltimateUnion.ts index 812d43929b..7ae6005e38 100644 --- a/test/generated/output/json.createAssertParse/test_json_createAssertParse_UltimateUnion.ts +++ b/test/generated/output/json.createAssertParse/test_json_createAssertParse_UltimateUnion.ts @@ -518,7 +518,7 @@ export const test_json_createAssertParse_UltimateUnion = _test_json_assertParse( Object.keys(input).every((key: any) => { const value = input[key]; if (undefined === value) return true; - if (RegExp(/(.*)/).test(key)) + if (true) return ( "object" === typeof value && null !== value && @@ -585,7 +585,7 @@ export const test_json_createAssertParse_UltimateUnion = _test_json_assertParse( Object.keys(input).every((key: any) => { const value = input[key]; if (undefined === value) return true; - if (RegExp(/(.*)/).test(key)) + if (true) return ( "object" === typeof value && null !== value && @@ -3393,7 +3393,7 @@ export const test_json_createAssertParse_UltimateUnion = _test_json_assertParse( Object.keys(input).every((key: any) => { const value = input[key]; if (undefined === value) return true; - if (RegExp(/(.*)/).test(key)) + if (true) return ( ((("object" === typeof value && null !== value && @@ -3649,7 +3649,7 @@ export const test_json_createAssertParse_UltimateUnion = _test_json_assertParse( Object.keys(input).every((key: any) => { const value = input[key]; if (undefined === value) return true; - if (RegExp(/(.*)/).test(key)) + if (true) return ( ((("object" === typeof value && null !== value && diff --git a/test/generated/output/json.createAssertStringify/test_json_createAssertStringify_DynamicComposite.ts b/test/generated/output/json.createAssertStringify/test_json_createAssertStringify_DynamicComposite.ts index 0575fc6c06..20ac2e9c61 100644 --- a/test/generated/output/json.createAssertStringify/test_json_createAssertStringify_DynamicComposite.ts +++ b/test/generated/output/json.createAssertStringify/test_json_createAssertStringify_DynamicComposite.ts @@ -17,21 +17,27 @@ export const test_json_createAssertStringify_DynamicComposite = const value = input[key]; if (undefined === value) return true; if ( - RegExp( - /^[+-]?\d+(?:\.\d+)?(?:[eE][+-]?\d+)?$/, - ).test(key) + "number" === typeof Number(key) && + Number.isFinite(Number(key)) ) return ( "number" === typeof value && Number.isFinite(value) ); - if (RegExp(/^(prefix_(.*))/).test(key)) + if ( + "string" === typeof key && + RegExp(/^prefix_(.*)/).test(key) + ) return "string" === typeof value; - if (RegExp(/((.*)_postfix)$/).test(key)) + if ( + "string" === typeof key && + RegExp(/(.*)_postfix$/).test(key) + ) return "string" === typeof value; if ( + "string" === typeof key && RegExp( - /^(value_[+-]?\d+(?:\.\d+)?(?:[eE][+-]?\d+)?)$/, + /^value_[+-]?\d+(?:\.\d+)?(?:[eE][+-]?\d+)?$/, ).test(key) ) return ( @@ -41,8 +47,9 @@ export const test_json_createAssertStringify_DynamicComposite = "boolean" === typeof value ); if ( + "string" === typeof key && RegExp( - /^(between_(.*)_and_[+-]?\d+(?:\.\d+)?(?:[eE][+-]?\d+)?)$/, + /^between_(.*)_and_[+-]?\d+(?:\.\d+)?(?:[eE][+-]?\d+)?$/, ).test(key) ) return "boolean" === typeof value; @@ -90,9 +97,8 @@ export const test_json_createAssertStringify_DynamicComposite = const value = input[key]; if (undefined === value) return true; if ( - RegExp( - /^[+-]?\d+(?:\.\d+)?(?:[eE][+-]?\d+)?$/, - ).test(key) + "number" === typeof Number(key) && + Number.isFinite(Number(key)) ) return ( ("number" === typeof value && @@ -103,7 +109,10 @@ export const test_json_createAssertStringify_DynamicComposite = value: value, }) ); - if (RegExp(/^(prefix_(.*))/).test(key)) + if ( + "string" === typeof key && + RegExp(/^prefix_(.*)/).test(key) + ) return ( "string" === typeof value || $guard(_exceptionable, { @@ -112,7 +121,10 @@ export const test_json_createAssertStringify_DynamicComposite = value: value, }) ); - if (RegExp(/((.*)_postfix)$/).test(key)) + if ( + "string" === typeof key && + RegExp(/(.*)_postfix$/).test(key) + ) return ( "string" === typeof value || $guard(_exceptionable, { @@ -122,8 +134,9 @@ export const test_json_createAssertStringify_DynamicComposite = }) ); if ( + "string" === typeof key && RegExp( - /^(value_[+-]?\d+(?:\.\d+)?(?:[eE][+-]?\d+)?)$/, + /^value_[+-]?\d+(?:\.\d+)?(?:[eE][+-]?\d+)?$/, ).test(key) ) return ( @@ -139,8 +152,9 @@ export const test_json_createAssertStringify_DynamicComposite = }) ); if ( + "string" === typeof key && RegExp( - /^(between_(.*)_and_[+-]?\d+(?:\.\d+)?(?:[eE][+-]?\d+)?)$/, + /^between_(.*)_and_[+-]?\d+(?:\.\d+)?(?:[eE][+-]?\d+)?$/, ).test(key) ) return ( diff --git a/test/generated/output/json.createAssertStringify/test_json_createAssertStringify_DynamicNever.ts b/test/generated/output/json.createAssertStringify/test_json_createAssertStringify_DynamicNever.ts index e3f4b7d684..a542e7aacf 100644 --- a/test/generated/output/json.createAssertStringify/test_json_createAssertStringify_DynamicNever.ts +++ b/test/generated/output/json.createAssertStringify/test_json_createAssertStringify_DynamicNever.ts @@ -11,7 +11,7 @@ export const test_json_createAssertStringify_DynamicNever = Object.keys(input).every((key: any) => { const value = input[key]; if (undefined === value) return true; - if (RegExp(/(.*)/).test(key)) + if (true) return null !== value && undefined === value; return true; }); @@ -41,7 +41,7 @@ export const test_json_createAssertStringify_DynamicNever = Object.keys(input).every((key: any) => { const value = input[key]; if (undefined === value) return true; - if (RegExp(/(.*)/).test(key)) + if (true) return ( (null !== value || $guard(_exceptionable, { diff --git a/test/generated/output/json.createAssertStringify/test_json_createAssertStringify_DynamicTemplate.ts b/test/generated/output/json.createAssertStringify/test_json_createAssertStringify_DynamicTemplate.ts index 398fec06d9..2a887be1f0 100644 --- a/test/generated/output/json.createAssertStringify/test_json_createAssertStringify_DynamicTemplate.ts +++ b/test/generated/output/json.createAssertStringify/test_json_createAssertStringify_DynamicTemplate.ts @@ -12,13 +12,20 @@ export const test_json_createAssertStringify_DynamicTemplate = Object.keys(input).every((key: any) => { const value = input[key]; if (undefined === value) return true; - if (RegExp(/^(prefix_(.*))/).test(key)) + if ( + "string" === typeof key && + RegExp(/^prefix_(.*)/).test(key) + ) return "string" === typeof value; - if (RegExp(/((.*)_postfix)$/).test(key)) + if ( + "string" === typeof key && + RegExp(/(.*)_postfix$/).test(key) + ) return "string" === typeof value; if ( + "string" === typeof key && RegExp( - /^(value_[+-]?\d+(?:\.\d+)?(?:[eE][+-]?\d+)?)$/, + /^value_[+-]?\d+(?:\.\d+)?(?:[eE][+-]?\d+)?$/, ).test(key) ) return ( @@ -26,8 +33,9 @@ export const test_json_createAssertStringify_DynamicTemplate = Number.isFinite(value) ); if ( + "string" === typeof key && RegExp( - /^(between_(.*)_and_[+-]?\d+(?:\.\d+)?(?:[eE][+-]?\d+)?)$/, + /^between_(.*)_and_[+-]?\d+(?:\.\d+)?(?:[eE][+-]?\d+)?$/, ).test(key) ) return "boolean" === typeof value; @@ -59,7 +67,10 @@ export const test_json_createAssertStringify_DynamicTemplate = Object.keys(input).every((key: any) => { const value = input[key]; if (undefined === value) return true; - if (RegExp(/^(prefix_(.*))/).test(key)) + if ( + "string" === typeof key && + RegExp(/^prefix_(.*)/).test(key) + ) return ( "string" === typeof value || $guard(_exceptionable, { @@ -68,7 +79,10 @@ export const test_json_createAssertStringify_DynamicTemplate = value: value, }) ); - if (RegExp(/((.*)_postfix)$/).test(key)) + if ( + "string" === typeof key && + RegExp(/(.*)_postfix$/).test(key) + ) return ( "string" === typeof value || $guard(_exceptionable, { @@ -78,8 +92,9 @@ export const test_json_createAssertStringify_DynamicTemplate = }) ); if ( + "string" === typeof key && RegExp( - /^(value_[+-]?\d+(?:\.\d+)?(?:[eE][+-]?\d+)?)$/, + /^value_[+-]?\d+(?:\.\d+)?(?:[eE][+-]?\d+)?$/, ).test(key) ) return ( @@ -92,8 +107,9 @@ export const test_json_createAssertStringify_DynamicTemplate = }) ); if ( + "string" === typeof key && RegExp( - /^(between_(.*)_and_[+-]?\d+(?:\.\d+)?(?:[eE][+-]?\d+)?)$/, + /^between_(.*)_and_[+-]?\d+(?:\.\d+)?(?:[eE][+-]?\d+)?$/, ).test(key) ) return ( diff --git a/test/generated/output/json.createAssertStringify/test_json_createAssertStringify_DynamicTree.ts b/test/generated/output/json.createAssertStringify/test_json_createAssertStringify_DynamicTree.ts index 18a20a3084..4a7bd5b8f6 100644 --- a/test/generated/output/json.createAssertStringify/test_json_createAssertStringify_DynamicTree.ts +++ b/test/generated/output/json.createAssertStringify/test_json_createAssertStringify_DynamicTree.ts @@ -19,7 +19,7 @@ export const test_json_createAssertStringify_DynamicTree = Object.keys(input).every((key: any) => { const value = input[key]; if (undefined === value) return true; - if (RegExp(/(.*)/).test(key)) + if (true) return ( "object" === typeof value && null !== value && @@ -88,7 +88,7 @@ export const test_json_createAssertStringify_DynamicTree = Object.keys(input).every((key: any) => { const value = input[key]; if (undefined === value) return true; - if (RegExp(/(.*)/).test(key)) + if (true) return ( ((("object" === typeof value && null !== value) || @@ -139,7 +139,7 @@ export const test_json_createAssertStringify_DynamicTree = Object.keys(input).every((key: any) => { const value = input[key]; if (undefined === value) return true; - if (RegExp(/(.*)/).test(key)) + if (true) return ( "object" === typeof value && null !== value && diff --git a/test/generated/output/json.createAssertStringify/test_json_createAssertStringify_DynamicUndefined.ts b/test/generated/output/json.createAssertStringify/test_json_createAssertStringify_DynamicUndefined.ts index 3291d0fcbf..6d2c768173 100644 --- a/test/generated/output/json.createAssertStringify/test_json_createAssertStringify_DynamicUndefined.ts +++ b/test/generated/output/json.createAssertStringify/test_json_createAssertStringify_DynamicUndefined.ts @@ -12,8 +12,7 @@ export const test_json_createAssertStringify_DynamicUndefined = Object.keys(input).every((key: any) => { const value = input[key]; if (undefined === value) return true; - if (RegExp(/(.*)/).test(key)) - return null !== value && undefined === value; + if (true) return null !== value && undefined === value; return true; }); return ( @@ -42,7 +41,7 @@ export const test_json_createAssertStringify_DynamicUndefined = Object.keys(input).every((key: any) => { const value = input[key]; if (undefined === value) return true; - if (RegExp(/(.*)/).test(key)) + if (true) return ( (null !== value || $guard(_exceptionable, { diff --git a/test/generated/output/json.createAssertStringify/test_json_createAssertStringify_DynamicUnion.ts b/test/generated/output/json.createAssertStringify/test_json_createAssertStringify_DynamicUnion.ts index e4285d998a..f95ae882fe 100644 --- a/test/generated/output/json.createAssertStringify/test_json_createAssertStringify_DynamicUnion.ts +++ b/test/generated/output/json.createAssertStringify/test_json_createAssertStringify_DynamicUnion.ts @@ -12,18 +12,24 @@ export const test_json_createAssertStringify_DynamicUnion = const value = input[key]; if (undefined === value) return true; if ( - RegExp( - /^[+-]?\d+(?:\.\d+)?(?:[eE][+-]?\d+)?$/, - ).test(key) + "number" === typeof Number(key) && + Number.isFinite(Number(key)) ) return "string" === typeof value; - if (RegExp(/^(prefix_(.*))/).test(key)) + if ( + "string" === typeof key && + RegExp(/^prefix_(.*)/).test(key) + ) return "string" === typeof value; - if (RegExp(/((.*)_postfix)$/).test(key)) + if ( + "string" === typeof key && + RegExp(/(.*)_postfix$/).test(key) + ) return "string" === typeof value; if ( + "string" === typeof key && RegExp( - /^(value_between_[+-]?\d+(?:\.\d+)?(?:[eE][+-]?\d+)?_and_[+-]?\d+(?:\.\d+)?(?:[eE][+-]?\d+)?)$/, + /^value_between_[+-]?\d+(?:\.\d+)?(?:[eE][+-]?\d+)?_and_[+-]?\d+(?:\.\d+)?(?:[eE][+-]?\d+)?$/, ).test(key) ) return ( @@ -59,9 +65,8 @@ export const test_json_createAssertStringify_DynamicUnion = const value = input[key]; if (undefined === value) return true; if ( - RegExp( - /^[+-]?\d+(?:\.\d+)?(?:[eE][+-]?\d+)?$/, - ).test(key) + "number" === typeof Number(key) && + Number.isFinite(Number(key)) ) return ( "string" === typeof value || @@ -71,7 +76,10 @@ export const test_json_createAssertStringify_DynamicUnion = value: value, }) ); - if (RegExp(/^(prefix_(.*))/).test(key)) + if ( + "string" === typeof key && + RegExp(/^prefix_(.*)/).test(key) + ) return ( "string" === typeof value || $guard(_exceptionable, { @@ -80,7 +88,10 @@ export const test_json_createAssertStringify_DynamicUnion = value: value, }) ); - if (RegExp(/((.*)_postfix)$/).test(key)) + if ( + "string" === typeof key && + RegExp(/(.*)_postfix$/).test(key) + ) return ( "string" === typeof value || $guard(_exceptionable, { @@ -90,8 +101,9 @@ export const test_json_createAssertStringify_DynamicUnion = }) ); if ( + "string" === typeof key && RegExp( - /^(value_between_[+-]?\d+(?:\.\d+)?(?:[eE][+-]?\d+)?_and_[+-]?\d+(?:\.\d+)?(?:[eE][+-]?\d+)?)$/, + /^value_between_[+-]?\d+(?:\.\d+)?(?:[eE][+-]?\d+)?_and_[+-]?\d+(?:\.\d+)?(?:[eE][+-]?\d+)?$/, ).test(key) ) return ( diff --git a/test/generated/output/json.createAssertStringify/test_json_createAssertStringify_ObjectDynamic.ts b/test/generated/output/json.createAssertStringify/test_json_createAssertStringify_ObjectDynamic.ts index 377d3c743e..0948ceb1d6 100644 --- a/test/generated/output/json.createAssertStringify/test_json_createAssertStringify_ObjectDynamic.ts +++ b/test/generated/output/json.createAssertStringify/test_json_createAssertStringify_ObjectDynamic.ts @@ -11,7 +11,7 @@ export const test_json_createAssertStringify_ObjectDynamic = Object.keys(input).every((key: any) => { const value = input[key]; if (undefined === value) return true; - if (RegExp(/(.*)/).test(key)) + if (true) return ( "string" === typeof value || ("number" === typeof value && @@ -46,7 +46,7 @@ export const test_json_createAssertStringify_ObjectDynamic = Object.keys(input).every((key: any) => { const value = input[key]; if (undefined === value) return true; - if (RegExp(/(.*)/).test(key)) + if (true) return ( "string" === typeof value || ("number" === typeof value && diff --git a/test/generated/output/json.createAssertStringify/test_json_createAssertStringify_UltimateUnion.ts b/test/generated/output/json.createAssertStringify/test_json_createAssertStringify_UltimateUnion.ts index 774a79282b..c317a5059a 100644 --- a/test/generated/output/json.createAssertStringify/test_json_createAssertStringify_UltimateUnion.ts +++ b/test/generated/output/json.createAssertStringify/test_json_createAssertStringify_UltimateUnion.ts @@ -522,7 +522,7 @@ export const test_json_createAssertStringify_UltimateUnion = Object.keys(input).every((key: any) => { const value = input[key]; if (undefined === value) return true; - if (RegExp(/(.*)/).test(key)) + if (true) return ( "object" === typeof value && null !== value && @@ -591,7 +591,7 @@ export const test_json_createAssertStringify_UltimateUnion = Object.keys(input).every((key: any) => { const value = input[key]; if (undefined === value) return true; - if (RegExp(/(.*)/).test(key)) + if (true) return ( "object" === typeof value && null !== value && @@ -3485,7 +3485,7 @@ export const test_json_createAssertStringify_UltimateUnion = Object.keys(input).every((key: any) => { const value = input[key]; if (undefined === value) return true; - if (RegExp(/(.*)/).test(key)) + if (true) return ( ((("object" === typeof value && null !== value && @@ -3760,7 +3760,7 @@ export const test_json_createAssertStringify_UltimateUnion = Object.keys(input).every((key: any) => { const value = input[key]; if (undefined === value) return true; - if (RegExp(/(.*)/).test(key)) + if (true) return ( ((("object" === typeof value && null !== value && @@ -6743,7 +6743,7 @@ export const test_json_createAssertStringify_UltimateUnion = Object.keys(input).every((key: any) => { const value = input[key]; if (undefined === value) return true; - if (RegExp(/(.*)/).test(key)) + if (true) return ( "object" === typeof value && null !== value && @@ -6810,7 +6810,7 @@ export const test_json_createAssertStringify_UltimateUnion = Object.keys(input).every((key: any) => { const value = input[key]; if (undefined === value) return true; - if (RegExp(/(.*)/).test(key)) + if (true) return ( "object" === typeof value && null !== value && diff --git a/test/generated/output/json.createIsParse/test_json_createIsParse_DynamicArray.ts b/test/generated/output/json.createIsParse/test_json_createIsParse_DynamicArray.ts index 9652289c29..c34e6b96de 100644 --- a/test/generated/output/json.createIsParse/test_json_createIsParse_DynamicArray.ts +++ b/test/generated/output/json.createIsParse/test_json_createIsParse_DynamicArray.ts @@ -15,7 +15,7 @@ export const test_json_createIsParse_DynamicArray = _test_json_isParse( Object.keys(input).every((key: any) => { const value = input[key]; if (undefined === value) return true; - if (RegExp(/(.*)/).test(key)) + if (true) return ( Array.isArray(value) && value.every((elem: any) => "string" === typeof elem) diff --git a/test/generated/output/json.createIsParse/test_json_createIsParse_DynamicComposite.ts b/test/generated/output/json.createIsParse/test_json_createIsParse_DynamicComposite.ts index 668b74ffff..e3b80d4a57 100644 --- a/test/generated/output/json.createIsParse/test_json_createIsParse_DynamicComposite.ts +++ b/test/generated/output/json.createIsParse/test_json_createIsParse_DynamicComposite.ts @@ -16,20 +16,26 @@ export const test_json_createIsParse_DynamicComposite = _test_json_isParse( const value = input[key]; if (undefined === value) return true; if ( - RegExp(/^[+-]?\d+(?:\.\d+)?(?:[eE][+-]?\d+)?$/).test( - key, - ) + "number" === typeof Number(key) && + Number.isFinite(Number(key)) ) return ( "number" === typeof value && Number.isFinite(value) ); - if (RegExp(/^(prefix_(.*))/).test(key)) + if ( + "string" === typeof key && + RegExp(/^prefix_(.*)/).test(key) + ) return "string" === typeof value; - if (RegExp(/((.*)_postfix)$/).test(key)) + if ( + "string" === typeof key && + RegExp(/(.*)_postfix$/).test(key) + ) return "string" === typeof value; if ( + "string" === typeof key && RegExp( - /^(value_[+-]?\d+(?:\.\d+)?(?:[eE][+-]?\d+)?)$/, + /^value_[+-]?\d+(?:\.\d+)?(?:[eE][+-]?\d+)?$/, ).test(key) ) return ( @@ -39,8 +45,9 @@ export const test_json_createIsParse_DynamicComposite = _test_json_isParse( "boolean" === typeof value ); if ( + "string" === typeof key && RegExp( - /^(between_(.*)_and_[+-]?\d+(?:\.\d+)?(?:[eE][+-]?\d+)?)$/, + /^between_(.*)_and_[+-]?\d+(?:\.\d+)?(?:[eE][+-]?\d+)?$/, ).test(key) ) return "boolean" === typeof value; diff --git a/test/generated/output/json.createIsParse/test_json_createIsParse_DynamicNever.ts b/test/generated/output/json.createIsParse/test_json_createIsParse_DynamicNever.ts index 13cf1159e5..659c8b7e2f 100644 --- a/test/generated/output/json.createIsParse/test_json_createIsParse_DynamicNever.ts +++ b/test/generated/output/json.createIsParse/test_json_createIsParse_DynamicNever.ts @@ -10,8 +10,7 @@ export const test_json_createIsParse_DynamicNever = _test_json_isParse( Object.keys(input).every((key: any) => { const value = input[key]; if (undefined === value) return true; - if (RegExp(/(.*)/).test(key)) - return null !== value && undefined === value; + if (true) return null !== value && undefined === value; return true; }); return ( diff --git a/test/generated/output/json.createIsParse/test_json_createIsParse_DynamicSimple.ts b/test/generated/output/json.createIsParse/test_json_createIsParse_DynamicSimple.ts index 4a7b0479ab..13ae7b656f 100644 --- a/test/generated/output/json.createIsParse/test_json_createIsParse_DynamicSimple.ts +++ b/test/generated/output/json.createIsParse/test_json_createIsParse_DynamicSimple.ts @@ -16,7 +16,7 @@ export const test_json_createIsParse_DynamicSimple = _test_json_isParse( Object.keys(input).every((key: any) => { const value = input[key]; if (undefined === value) return true; - if (RegExp(/(.*)/).test(key)) + if (true) return ( "number" === typeof value && Number.isFinite(value) ); diff --git a/test/generated/output/json.createIsParse/test_json_createIsParse_DynamicTemplate.ts b/test/generated/output/json.createIsParse/test_json_createIsParse_DynamicTemplate.ts index d322491f1e..e2e5885d1a 100644 --- a/test/generated/output/json.createIsParse/test_json_createIsParse_DynamicTemplate.ts +++ b/test/generated/output/json.createIsParse/test_json_createIsParse_DynamicTemplate.ts @@ -11,21 +11,29 @@ export const test_json_createIsParse_DynamicTemplate = _test_json_isParse( Object.keys(input).every((key: any) => { const value = input[key]; if (undefined === value) return true; - if (RegExp(/^(prefix_(.*))/).test(key)) + if ( + "string" === typeof key && + RegExp(/^prefix_(.*)/).test(key) + ) return "string" === typeof value; - if (RegExp(/((.*)_postfix)$/).test(key)) + if ( + "string" === typeof key && + RegExp(/(.*)_postfix$/).test(key) + ) return "string" === typeof value; if ( + "string" === typeof key && RegExp( - /^(value_[+-]?\d+(?:\.\d+)?(?:[eE][+-]?\d+)?)$/, + /^value_[+-]?\d+(?:\.\d+)?(?:[eE][+-]?\d+)?$/, ).test(key) ) return ( "number" === typeof value && Number.isFinite(value) ); if ( + "string" === typeof key && RegExp( - /^(between_(.*)_and_[+-]?\d+(?:\.\d+)?(?:[eE][+-]?\d+)?)$/, + /^between_(.*)_and_[+-]?\d+(?:\.\d+)?(?:[eE][+-]?\d+)?$/, ).test(key) ) return "boolean" === typeof value; diff --git a/test/generated/output/json.createIsParse/test_json_createIsParse_DynamicTree.ts b/test/generated/output/json.createIsParse/test_json_createIsParse_DynamicTree.ts index 2d04f5c2b6..63c01f6deb 100644 --- a/test/generated/output/json.createIsParse/test_json_createIsParse_DynamicTree.ts +++ b/test/generated/output/json.createIsParse/test_json_createIsParse_DynamicTree.ts @@ -18,7 +18,7 @@ export const test_json_createIsParse_DynamicTree = _test_json_isParse( Object.keys(input).every((key: any) => { const value = input[key]; if (undefined === value) return true; - if (RegExp(/(.*)/).test(key)) + if (true) return ( "object" === typeof value && null !== value && diff --git a/test/generated/output/json.createIsParse/test_json_createIsParse_DynamicUndefined.ts b/test/generated/output/json.createIsParse/test_json_createIsParse_DynamicUndefined.ts index 27a77a6834..d0caa82604 100644 --- a/test/generated/output/json.createIsParse/test_json_createIsParse_DynamicUndefined.ts +++ b/test/generated/output/json.createIsParse/test_json_createIsParse_DynamicUndefined.ts @@ -11,8 +11,7 @@ export const test_json_createIsParse_DynamicUndefined = _test_json_isParse( Object.keys(input).every((key: any) => { const value = input[key]; if (undefined === value) return true; - if (RegExp(/(.*)/).test(key)) - return null !== value && undefined === value; + if (true) return null !== value && undefined === value; return true; }); return ( diff --git a/test/generated/output/json.createIsParse/test_json_createIsParse_DynamicUnion.ts b/test/generated/output/json.createIsParse/test_json_createIsParse_DynamicUnion.ts index af539fc5df..7846d68fd6 100644 --- a/test/generated/output/json.createIsParse/test_json_createIsParse_DynamicUnion.ts +++ b/test/generated/output/json.createIsParse/test_json_createIsParse_DynamicUnion.ts @@ -10,15 +10,22 @@ export const test_json_createIsParse_DynamicUnion = _test_json_isParse( Object.keys(input).every((key: any) => { const value = input[key]; if (undefined === value) return true; - if (RegExp(/^[+-]?\d+(?:\.\d+)?(?:[eE][+-]?\d+)?$/).test(key)) + if ( + "number" === typeof Number(key) && + Number.isFinite(Number(key)) + ) return "string" === typeof value; - if (RegExp(/^(prefix_(.*))/).test(key)) + if ("string" === typeof key && RegExp(/^prefix_(.*)/).test(key)) return "string" === typeof value; - if (RegExp(/((.*)_postfix)$/).test(key)) + if ( + "string" === typeof key && + RegExp(/(.*)_postfix$/).test(key) + ) return "string" === typeof value; if ( + "string" === typeof key && RegExp( - /^(value_between_[+-]?\d+(?:\.\d+)?(?:[eE][+-]?\d+)?_and_[+-]?\d+(?:\.\d+)?(?:[eE][+-]?\d+)?)$/, + /^value_between_[+-]?\d+(?:\.\d+)?(?:[eE][+-]?\d+)?_and_[+-]?\d+(?:\.\d+)?(?:[eE][+-]?\d+)?$/, ).test(key) ) return "number" === typeof value && Number.isFinite(value); diff --git a/test/generated/output/json.createIsParse/test_json_createIsParse_ObjectDynamic.ts b/test/generated/output/json.createIsParse/test_json_createIsParse_ObjectDynamic.ts index 8757fb8160..4d8d62fb99 100644 --- a/test/generated/output/json.createIsParse/test_json_createIsParse_ObjectDynamic.ts +++ b/test/generated/output/json.createIsParse/test_json_createIsParse_ObjectDynamic.ts @@ -11,7 +11,7 @@ export const test_json_createIsParse_ObjectDynamic = _test_json_isParse( Object.keys(input).every((key: any) => { const value = input[key]; if (undefined === value) return true; - if (RegExp(/(.*)/).test(key)) + if (true) return ( "string" === typeof value || ("number" === typeof value && diff --git a/test/generated/output/json.createIsParse/test_json_createIsParse_UltimateUnion.ts b/test/generated/output/json.createIsParse/test_json_createIsParse_UltimateUnion.ts index 3c42dbb09d..fcdfa3b796 100644 --- a/test/generated/output/json.createIsParse/test_json_createIsParse_UltimateUnion.ts +++ b/test/generated/output/json.createIsParse/test_json_createIsParse_UltimateUnion.ts @@ -513,7 +513,7 @@ export const test_json_createIsParse_UltimateUnion = _test_json_isParse( Object.keys(input).every((key: any) => { const value = input[key]; if (undefined === value) return true; - if (RegExp(/(.*)/).test(key)) + if (true) return ( "object" === typeof value && null !== value && @@ -575,7 +575,7 @@ export const test_json_createIsParse_UltimateUnion = _test_json_isParse( Object.keys(input).every((key: any) => { const value = input[key]; if (undefined === value) return true; - if (RegExp(/(.*)/).test(key)) + if (true) return ( "object" === typeof value && null !== value && diff --git a/test/generated/output/json.createIsStringify/test_json_createIsStringify_DynamicArray.ts b/test/generated/output/json.createIsStringify/test_json_createIsStringify_DynamicArray.ts index eed33cb26a..ad7cdae387 100644 --- a/test/generated/output/json.createIsStringify/test_json_createIsStringify_DynamicArray.ts +++ b/test/generated/output/json.createIsStringify/test_json_createIsStringify_DynamicArray.ts @@ -15,7 +15,7 @@ export const test_json_createIsStringify_DynamicArray = _test_json_isStringify( Object.keys(input).every((key: any) => { const value = input[key]; if (undefined === value) return true; - if (RegExp(/(.*)/).test(key)) + if (true) return ( Array.isArray(value) && value.every((elem: any) => "string" === typeof elem) @@ -29,7 +29,7 @@ export const test_json_createIsStringify_DynamicArray = _test_json_isStringify( Object.keys(input).every((key: any) => { const value = input[key]; if (undefined === value) return true; - if (RegExp(/(.*)/).test(key)) + if (true) return ( Array.isArray(value) && value.every((elem: any) => "string" === typeof elem) diff --git a/test/generated/output/json.createIsStringify/test_json_createIsStringify_DynamicComposite.ts b/test/generated/output/json.createIsStringify/test_json_createIsStringify_DynamicComposite.ts index c7ea70e883..b451ed2670 100644 --- a/test/generated/output/json.createIsStringify/test_json_createIsStringify_DynamicComposite.ts +++ b/test/generated/output/json.createIsStringify/test_json_createIsStringify_DynamicComposite.ts @@ -16,20 +16,26 @@ export const test_json_createIsStringify_DynamicComposite = const value = input[key]; if (undefined === value) return true; if ( - RegExp(/^[+-]?\d+(?:\.\d+)?(?:[eE][+-]?\d+)?$/).test( - key, - ) + "number" === typeof Number(key) && + Number.isFinite(Number(key)) ) return ( "number" === typeof value && Number.isFinite(value) ); - if (RegExp(/^(prefix_(.*))/).test(key)) + if ( + "string" === typeof key && + RegExp(/^prefix_(.*)/).test(key) + ) return "string" === typeof value; - if (RegExp(/((.*)_postfix)$/).test(key)) + if ( + "string" === typeof key && + RegExp(/(.*)_postfix$/).test(key) + ) return "string" === typeof value; if ( + "string" === typeof key && RegExp( - /^(value_[+-]?\d+(?:\.\d+)?(?:[eE][+-]?\d+)?)$/, + /^value_[+-]?\d+(?:\.\d+)?(?:[eE][+-]?\d+)?$/, ).test(key) ) return ( @@ -39,8 +45,9 @@ export const test_json_createIsStringify_DynamicComposite = "boolean" === typeof value ); if ( + "string" === typeof key && RegExp( - /^(between_(.*)_and_[+-]?\d+(?:\.\d+)?(?:[eE][+-]?\d+)?)$/, + /^between_(.*)_and_[+-]?\d+(?:\.\d+)?(?:[eE][+-]?\d+)?$/, ).test(key) ) return "boolean" === typeof value; diff --git a/test/generated/output/json.createIsStringify/test_json_createIsStringify_DynamicNever.ts b/test/generated/output/json.createIsStringify/test_json_createIsStringify_DynamicNever.ts index 3a5e2b5a3c..f80eac3717 100644 --- a/test/generated/output/json.createIsStringify/test_json_createIsStringify_DynamicNever.ts +++ b/test/generated/output/json.createIsStringify/test_json_createIsStringify_DynamicNever.ts @@ -10,8 +10,7 @@ export const test_json_createIsStringify_DynamicNever = _test_json_isStringify( Object.keys(input).every((key: any) => { const value = input[key]; if (undefined === value) return true; - if (RegExp(/(.*)/).test(key)) - return null !== value && undefined === value; + if (true) return null !== value && undefined === value; return true; }); return ( diff --git a/test/generated/output/json.createIsStringify/test_json_createIsStringify_DynamicSimple.ts b/test/generated/output/json.createIsStringify/test_json_createIsStringify_DynamicSimple.ts index d9809c6bcb..8cc411f077 100644 --- a/test/generated/output/json.createIsStringify/test_json_createIsStringify_DynamicSimple.ts +++ b/test/generated/output/json.createIsStringify/test_json_createIsStringify_DynamicSimple.ts @@ -15,7 +15,7 @@ export const test_json_createIsStringify_DynamicSimple = _test_json_isStringify( Object.keys(input).every((key: any) => { const value = input[key]; if (undefined === value) return true; - if (RegExp(/(.*)/).test(key)) + if (true) return "number" === typeof value && Number.isFinite(value); return true; }); @@ -26,7 +26,7 @@ export const test_json_createIsStringify_DynamicSimple = _test_json_isStringify( Object.keys(input).every((key: any) => { const value = input[key]; if (undefined === value) return true; - if (RegExp(/(.*)/).test(key)) return "number" === typeof value; + if (true) return "number" === typeof value; return true; }); const $number = (typia.json.createIsStringify as any).number; diff --git a/test/generated/output/json.createIsStringify/test_json_createIsStringify_DynamicTemplate.ts b/test/generated/output/json.createIsStringify/test_json_createIsStringify_DynamicTemplate.ts index a52474cb30..9f07e3df2f 100644 --- a/test/generated/output/json.createIsStringify/test_json_createIsStringify_DynamicTemplate.ts +++ b/test/generated/output/json.createIsStringify/test_json_createIsStringify_DynamicTemplate.ts @@ -10,13 +10,20 @@ export const test_json_createIsStringify_DynamicTemplate = Object.keys(input).every((key: any) => { const value = input[key]; if (undefined === value) return true; - if (RegExp(/^(prefix_(.*))/).test(key)) + if ( + "string" === typeof key && + RegExp(/^prefix_(.*)/).test(key) + ) return "string" === typeof value; - if (RegExp(/((.*)_postfix)$/).test(key)) + if ( + "string" === typeof key && + RegExp(/(.*)_postfix$/).test(key) + ) return "string" === typeof value; if ( + "string" === typeof key && RegExp( - /^(value_[+-]?\d+(?:\.\d+)?(?:[eE][+-]?\d+)?)$/, + /^value_[+-]?\d+(?:\.\d+)?(?:[eE][+-]?\d+)?$/, ).test(key) ) return ( @@ -24,8 +31,9 @@ export const test_json_createIsStringify_DynamicTemplate = Number.isFinite(value) ); if ( + "string" === typeof key && RegExp( - /^(between_(.*)_and_[+-]?\d+(?:\.\d+)?(?:[eE][+-]?\d+)?)$/, + /^between_(.*)_and_[+-]?\d+(?:\.\d+)?(?:[eE][+-]?\d+)?$/, ).test(key) ) return "boolean" === typeof value; diff --git a/test/generated/output/json.createIsStringify/test_json_createIsStringify_DynamicTree.ts b/test/generated/output/json.createIsStringify/test_json_createIsStringify_DynamicTree.ts index bcd36cd70b..af417bd069 100644 --- a/test/generated/output/json.createIsStringify/test_json_createIsStringify_DynamicTree.ts +++ b/test/generated/output/json.createIsStringify/test_json_createIsStringify_DynamicTree.ts @@ -18,7 +18,7 @@ export const test_json_createIsStringify_DynamicTree = _test_json_isStringify( Object.keys(input).every((key: any) => { const value = input[key]; if (undefined === value) return true; - if (RegExp(/(.*)/).test(key)) + if (true) return ( "object" === typeof value && null !== value && @@ -40,7 +40,7 @@ export const test_json_createIsStringify_DynamicTree = _test_json_isStringify( Object.keys(input).every((key: any) => { const value = input[key]; if (undefined === value) return true; - if (RegExp(/(.*)/).test(key)) + if (true) return ( "object" === typeof value && null !== value && diff --git a/test/generated/output/json.createIsStringify/test_json_createIsStringify_DynamicUndefined.ts b/test/generated/output/json.createIsStringify/test_json_createIsStringify_DynamicUndefined.ts index 8591e80d02..e778ef81f5 100644 --- a/test/generated/output/json.createIsStringify/test_json_createIsStringify_DynamicUndefined.ts +++ b/test/generated/output/json.createIsStringify/test_json_createIsStringify_DynamicUndefined.ts @@ -11,8 +11,7 @@ export const test_json_createIsStringify_DynamicUndefined = Object.keys(input).every((key: any) => { const value = input[key]; if (undefined === value) return true; - if (RegExp(/(.*)/).test(key)) - return null !== value && undefined === value; + if (true) return null !== value && undefined === value; return true; }); return ( diff --git a/test/generated/output/json.createIsStringify/test_json_createIsStringify_DynamicUnion.ts b/test/generated/output/json.createIsStringify/test_json_createIsStringify_DynamicUnion.ts index 6872c3e225..590d54698b 100644 --- a/test/generated/output/json.createIsStringify/test_json_createIsStringify_DynamicUnion.ts +++ b/test/generated/output/json.createIsStringify/test_json_createIsStringify_DynamicUnion.ts @@ -10,15 +10,22 @@ export const test_json_createIsStringify_DynamicUnion = _test_json_isStringify( Object.keys(input).every((key: any) => { const value = input[key]; if (undefined === value) return true; - if (RegExp(/^[+-]?\d+(?:\.\d+)?(?:[eE][+-]?\d+)?$/).test(key)) + if ( + "number" === typeof Number(key) && + Number.isFinite(Number(key)) + ) return "string" === typeof value; - if (RegExp(/^(prefix_(.*))/).test(key)) + if ("string" === typeof key && RegExp(/^prefix_(.*)/).test(key)) return "string" === typeof value; - if (RegExp(/((.*)_postfix)$/).test(key)) + if ( + "string" === typeof key && + RegExp(/(.*)_postfix$/).test(key) + ) return "string" === typeof value; if ( + "string" === typeof key && RegExp( - /^(value_between_[+-]?\d+(?:\.\d+)?(?:[eE][+-]?\d+)?_and_[+-]?\d+(?:\.\d+)?(?:[eE][+-]?\d+)?)$/, + /^value_between_[+-]?\d+(?:\.\d+)?(?:[eE][+-]?\d+)?_and_[+-]?\d+(?:\.\d+)?(?:[eE][+-]?\d+)?$/, ).test(key) ) return "number" === typeof value && Number.isFinite(value); diff --git a/test/generated/output/json.createIsStringify/test_json_createIsStringify_ObjectDynamic.ts b/test/generated/output/json.createIsStringify/test_json_createIsStringify_ObjectDynamic.ts index 6b6ee1186d..ceeaf756ce 100644 --- a/test/generated/output/json.createIsStringify/test_json_createIsStringify_ObjectDynamic.ts +++ b/test/generated/output/json.createIsStringify/test_json_createIsStringify_ObjectDynamic.ts @@ -10,7 +10,7 @@ export const test_json_createIsStringify_ObjectDynamic = _test_json_isStringify( Object.keys(input).every((key: any) => { const value = input[key]; if (undefined === value) return true; - if (RegExp(/(.*)/).test(key)) + if (true) return ( "string" === typeof value || ("number" === typeof value && Number.isFinite(value)) || diff --git a/test/generated/output/json.createIsStringify/test_json_createIsStringify_UltimateUnion.ts b/test/generated/output/json.createIsStringify/test_json_createIsStringify_UltimateUnion.ts index a9e1199386..5be55b91c6 100644 --- a/test/generated/output/json.createIsStringify/test_json_createIsStringify_UltimateUnion.ts +++ b/test/generated/output/json.createIsStringify/test_json_createIsStringify_UltimateUnion.ts @@ -497,7 +497,7 @@ export const test_json_createIsStringify_UltimateUnion = _test_json_isStringify( Object.keys(input).every((key: any) => { const value = input[key]; if (undefined === value) return true; - if (RegExp(/(.*)/).test(key)) + if (true) return ( "object" === typeof value && null !== value && @@ -556,7 +556,7 @@ export const test_json_createIsStringify_UltimateUnion = _test_json_isStringify( Object.keys(input).every((key: any) => { const value = input[key]; if (undefined === value) return true; - if (RegExp(/(.*)/).test(key)) + if (true) return ( "object" === typeof value && null !== value && @@ -1591,7 +1591,7 @@ export const test_json_createIsStringify_UltimateUnion = _test_json_isStringify( Object.keys(input).every((key: any) => { const value = input[key]; if (undefined === value) return true; - if (RegExp(/(.*)/).test(key)) + if (true) return ( "object" === typeof value && null !== value && @@ -1650,7 +1650,7 @@ export const test_json_createIsStringify_UltimateUnion = _test_json_isStringify( Object.keys(input).every((key: any) => { const value = input[key]; if (undefined === value) return true; - if (RegExp(/(.*)/).test(key)) + if (true) return ( "object" === typeof value && null !== value && diff --git a/test/generated/output/json.createStringify/test_json_createStringify_DynamicArray.ts b/test/generated/output/json.createStringify/test_json_createStringify_DynamicArray.ts index 40b7103368..b89e43fd67 100644 --- a/test/generated/output/json.createStringify/test_json_createStringify_DynamicArray.ts +++ b/test/generated/output/json.createStringify/test_json_createStringify_DynamicArray.ts @@ -9,7 +9,7 @@ export const test_json_createStringify_DynamicArray = _test_json_stringify( Object.keys(input).every((key: any) => { const value = input[key]; if (undefined === value) return true; - if (RegExp(/(.*)/).test(key)) + if (true) return ( Array.isArray(value) && value.every((elem: any) => "string" === typeof elem) diff --git a/test/generated/output/json.createStringify/test_json_createStringify_DynamicSimple.ts b/test/generated/output/json.createStringify/test_json_createStringify_DynamicSimple.ts index cc68575a54..8beb99a2b2 100644 --- a/test/generated/output/json.createStringify/test_json_createStringify_DynamicSimple.ts +++ b/test/generated/output/json.createStringify/test_json_createStringify_DynamicSimple.ts @@ -9,7 +9,7 @@ export const test_json_createStringify_DynamicSimple = _test_json_stringify( Object.keys(input).every((key: any) => { const value = input[key]; if (undefined === value) return true; - if (RegExp(/(.*)/).test(key)) return "number" === typeof value; + if (true) return "number" === typeof value; return true; }); const $number = (typia.json.createStringify as any).number; diff --git a/test/generated/output/json.createStringify/test_json_createStringify_DynamicTree.ts b/test/generated/output/json.createStringify/test_json_createStringify_DynamicTree.ts index 9d73c2c7e4..7f78ac84dc 100644 --- a/test/generated/output/json.createStringify/test_json_createStringify_DynamicTree.ts +++ b/test/generated/output/json.createStringify/test_json_createStringify_DynamicTree.ts @@ -16,7 +16,7 @@ export const test_json_createStringify_DynamicTree = _test_json_stringify( Object.keys(input).every((key: any) => { const value = input[key]; if (undefined === value) return true; - if (RegExp(/(.*)/).test(key)) + if (true) return ( "object" === typeof value && null !== value && $io0(value) ); diff --git a/test/generated/output/json.createStringify/test_json_createStringify_UltimateUnion.ts b/test/generated/output/json.createStringify/test_json_createStringify_UltimateUnion.ts index 5a9e860dd4..4bdc2b0e33 100644 --- a/test/generated/output/json.createStringify/test_json_createStringify_UltimateUnion.ts +++ b/test/generated/output/json.createStringify/test_json_createStringify_UltimateUnion.ts @@ -424,7 +424,7 @@ export const test_json_createStringify_UltimateUnion = _test_json_stringify( Object.keys(input).every((key: any) => { const value = input[key]; if (undefined === value) return true; - if (RegExp(/(.*)/).test(key)) + if (true) return ( "object" === typeof value && null !== value && @@ -479,7 +479,7 @@ export const test_json_createStringify_UltimateUnion = _test_json_stringify( Object.keys(input).every((key: any) => { const value = input[key]; if (undefined === value) return true; - if (RegExp(/(.*)/).test(key)) + if (true) return ( "object" === typeof value && null !== value && diff --git a/test/generated/output/json.createValidateParse/test_json_createValidateParse_DynamicComposite.ts b/test/generated/output/json.createValidateParse/test_json_createValidateParse_DynamicComposite.ts index ea97c18ea1..f708a9efc6 100644 --- a/test/generated/output/json.createValidateParse/test_json_createValidateParse_DynamicComposite.ts +++ b/test/generated/output/json.createValidateParse/test_json_createValidateParse_DynamicComposite.ts @@ -18,21 +18,27 @@ export const test_json_createValidateParse_DynamicComposite = const value = input[key]; if (undefined === value) return true; if ( - RegExp( - /^[+-]?\d+(?:\.\d+)?(?:[eE][+-]?\d+)?$/, - ).test(key) + "number" === typeof Number(key) && + Number.isFinite(Number(key)) ) return ( "number" === typeof value && Number.isFinite(value) ); - if (RegExp(/^(prefix_(.*))/).test(key)) + if ( + "string" === typeof key && + RegExp(/^prefix_(.*)/).test(key) + ) return "string" === typeof value; - if (RegExp(/((.*)_postfix)$/).test(key)) + if ( + "string" === typeof key && + RegExp(/(.*)_postfix$/).test(key) + ) return "string" === typeof value; if ( + "string" === typeof key && RegExp( - /^(value_[+-]?\d+(?:\.\d+)?(?:[eE][+-]?\d+)?)$/, + /^value_[+-]?\d+(?:\.\d+)?(?:[eE][+-]?\d+)?$/, ).test(key) ) return ( @@ -42,8 +48,9 @@ export const test_json_createValidateParse_DynamicComposite = "boolean" === typeof value ); if ( + "string" === typeof key && RegExp( - /^(between_(.*)_and_[+-]?\d+(?:\.\d+)?(?:[eE][+-]?\d+)?)$/, + /^between_(.*)_and_[+-]?\d+(?:\.\d+)?(?:[eE][+-]?\d+)?$/, ).test(key) ) return "boolean" === typeof value; @@ -93,9 +100,8 @@ export const test_json_createValidateParse_DynamicComposite = const value = input[key]; if (undefined === value) return true; if ( - RegExp( - /^[+-]?\d+(?:\.\d+)?(?:[eE][+-]?\d+)?$/, - ).test(key) + "number" === typeof Number(key) && + Number.isFinite(Number(key)) ) return ( ("number" === typeof value && @@ -106,7 +112,10 @@ export const test_json_createValidateParse_DynamicComposite = value: value, }) ); - if (RegExp(/^(prefix_(.*))/).test(key)) + if ( + "string" === typeof key && + RegExp(/^prefix_(.*)/).test(key) + ) return ( "string" === typeof value || $report(_exceptionable, { @@ -115,7 +124,10 @@ export const test_json_createValidateParse_DynamicComposite = value: value, }) ); - if (RegExp(/((.*)_postfix)$/).test(key)) + if ( + "string" === typeof key && + RegExp(/(.*)_postfix$/).test(key) + ) return ( "string" === typeof value || $report(_exceptionable, { @@ -125,8 +137,9 @@ export const test_json_createValidateParse_DynamicComposite = }) ); if ( + "string" === typeof key && RegExp( - /^(value_[+-]?\d+(?:\.\d+)?(?:[eE][+-]?\d+)?)$/, + /^value_[+-]?\d+(?:\.\d+)?(?:[eE][+-]?\d+)?$/, ).test(key) ) return ( @@ -142,8 +155,9 @@ export const test_json_createValidateParse_DynamicComposite = }) ); if ( + "string" === typeof key && RegExp( - /^(between_(.*)_and_[+-]?\d+(?:\.\d+)?(?:[eE][+-]?\d+)?)$/, + /^between_(.*)_and_[+-]?\d+(?:\.\d+)?(?:[eE][+-]?\d+)?$/, ).test(key) ) return ( diff --git a/test/generated/output/json.createValidateParse/test_json_createValidateParse_DynamicNever.ts b/test/generated/output/json.createValidateParse/test_json_createValidateParse_DynamicNever.ts index 222275bf67..01bcf21c5d 100644 --- a/test/generated/output/json.createValidateParse/test_json_createValidateParse_DynamicNever.ts +++ b/test/generated/output/json.createValidateParse/test_json_createValidateParse_DynamicNever.ts @@ -12,7 +12,7 @@ export const test_json_createValidateParse_DynamicNever = Object.keys(input).every((key: any) => { const value = input[key]; if (undefined === value) return true; - if (RegExp(/(.*)/).test(key)) + if (true) return null !== value && undefined === value; return true; }); @@ -46,7 +46,7 @@ export const test_json_createValidateParse_DynamicNever = const value = input[key]; if (undefined === value) return true; - if (RegExp(/(.*)/).test(key)) + if (true) return ( (null !== value || $report( diff --git a/test/generated/output/json.createValidateParse/test_json_createValidateParse_DynamicTemplate.ts b/test/generated/output/json.createValidateParse/test_json_createValidateParse_DynamicTemplate.ts index c4a676497a..cc0094c56e 100644 --- a/test/generated/output/json.createValidateParse/test_json_createValidateParse_DynamicTemplate.ts +++ b/test/generated/output/json.createValidateParse/test_json_createValidateParse_DynamicTemplate.ts @@ -13,13 +13,20 @@ export const test_json_createValidateParse_DynamicTemplate = Object.keys(input).every((key: any) => { const value = input[key]; if (undefined === value) return true; - if (RegExp(/^(prefix_(.*))/).test(key)) + if ( + "string" === typeof key && + RegExp(/^prefix_(.*)/).test(key) + ) return "string" === typeof value; - if (RegExp(/((.*)_postfix)$/).test(key)) + if ( + "string" === typeof key && + RegExp(/(.*)_postfix$/).test(key) + ) return "string" === typeof value; if ( + "string" === typeof key && RegExp( - /^(value_[+-]?\d+(?:\.\d+)?(?:[eE][+-]?\d+)?)$/, + /^value_[+-]?\d+(?:\.\d+)?(?:[eE][+-]?\d+)?$/, ).test(key) ) return ( @@ -27,8 +34,9 @@ export const test_json_createValidateParse_DynamicTemplate = Number.isFinite(value) ); if ( + "string" === typeof key && RegExp( - /^(between_(.*)_and_[+-]?\d+(?:\.\d+)?(?:[eE][+-]?\d+)?)$/, + /^between_(.*)_and_[+-]?\d+(?:\.\d+)?(?:[eE][+-]?\d+)?$/, ).test(key) ) return "boolean" === typeof value; @@ -62,7 +70,10 @@ export const test_json_createValidateParse_DynamicTemplate = .map((key: any) => { const value = input[key]; if (undefined === value) return true; - if (RegExp(/^(prefix_(.*))/).test(key)) + if ( + "string" === typeof key && + RegExp(/^prefix_(.*)/).test(key) + ) return ( "string" === typeof value || $report(_exceptionable, { @@ -71,7 +82,10 @@ export const test_json_createValidateParse_DynamicTemplate = value: value, }) ); - if (RegExp(/((.*)_postfix)$/).test(key)) + if ( + "string" === typeof key && + RegExp(/(.*)_postfix$/).test(key) + ) return ( "string" === typeof value || $report(_exceptionable, { @@ -81,8 +95,9 @@ export const test_json_createValidateParse_DynamicTemplate = }) ); if ( + "string" === typeof key && RegExp( - /^(value_[+-]?\d+(?:\.\d+)?(?:[eE][+-]?\d+)?)$/, + /^value_[+-]?\d+(?:\.\d+)?(?:[eE][+-]?\d+)?$/, ).test(key) ) return ( @@ -95,8 +110,9 @@ export const test_json_createValidateParse_DynamicTemplate = }) ); if ( + "string" === typeof key && RegExp( - /^(between_(.*)_and_[+-]?\d+(?:\.\d+)?(?:[eE][+-]?\d+)?)$/, + /^between_(.*)_and_[+-]?\d+(?:\.\d+)?(?:[eE][+-]?\d+)?$/, ).test(key) ) return ( diff --git a/test/generated/output/json.createValidateParse/test_json_createValidateParse_DynamicTree.ts b/test/generated/output/json.createValidateParse/test_json_createValidateParse_DynamicTree.ts index 821a60a2eb..9be774b707 100644 --- a/test/generated/output/json.createValidateParse/test_json_createValidateParse_DynamicTree.ts +++ b/test/generated/output/json.createValidateParse/test_json_createValidateParse_DynamicTree.ts @@ -20,7 +20,7 @@ export const test_json_createValidateParse_DynamicTree = Object.keys(input).every((key: any) => { const value = input[key]; if (undefined === value) return true; - if (RegExp(/(.*)/).test(key)) + if (true) return ( "object" === typeof value && null !== value && @@ -95,7 +95,7 @@ export const test_json_createValidateParse_DynamicTree = const value = input[key]; if (undefined === value) return true; - if (RegExp(/(.*)/).test(key)) + if (true) return ( ((("object" === typeof value && diff --git a/test/generated/output/json.createValidateParse/test_json_createValidateParse_DynamicUndefined.ts b/test/generated/output/json.createValidateParse/test_json_createValidateParse_DynamicUndefined.ts index e74a4691ab..479854a1ce 100644 --- a/test/generated/output/json.createValidateParse/test_json_createValidateParse_DynamicUndefined.ts +++ b/test/generated/output/json.createValidateParse/test_json_createValidateParse_DynamicUndefined.ts @@ -13,8 +13,7 @@ export const test_json_createValidateParse_DynamicUndefined = Object.keys(input).every((key: any) => { const value = input[key]; if (undefined === value) return true; - if (RegExp(/(.*)/).test(key)) - return null !== value && undefined === value; + if (true) return null !== value && undefined === value; return true; }); return ( @@ -45,7 +44,7 @@ export const test_json_createValidateParse_DynamicUndefined = .map((key: any) => { const value = input[key]; if (undefined === value) return true; - if (RegExp(/(.*)/).test(key)) + if (true) return ( (null !== value || $report(_exceptionable, { diff --git a/test/generated/output/json.createValidateParse/test_json_createValidateParse_DynamicUnion.ts b/test/generated/output/json.createValidateParse/test_json_createValidateParse_DynamicUnion.ts index 330202eb1c..53f42e64e4 100644 --- a/test/generated/output/json.createValidateParse/test_json_createValidateParse_DynamicUnion.ts +++ b/test/generated/output/json.createValidateParse/test_json_createValidateParse_DynamicUnion.ts @@ -13,18 +13,24 @@ export const test_json_createValidateParse_DynamicUnion = const value = input[key]; if (undefined === value) return true; if ( - RegExp( - /^[+-]?\d+(?:\.\d+)?(?:[eE][+-]?\d+)?$/, - ).test(key) + "number" === typeof Number(key) && + Number.isFinite(Number(key)) ) return "string" === typeof value; - if (RegExp(/^(prefix_(.*))/).test(key)) + if ( + "string" === typeof key && + RegExp(/^prefix_(.*)/).test(key) + ) return "string" === typeof value; - if (RegExp(/((.*)_postfix)$/).test(key)) + if ( + "string" === typeof key && + RegExp(/(.*)_postfix$/).test(key) + ) return "string" === typeof value; if ( + "string" === typeof key && RegExp( - /^(value_between_[+-]?\d+(?:\.\d+)?(?:[eE][+-]?\d+)?_and_[+-]?\d+(?:\.\d+)?(?:[eE][+-]?\d+)?)$/, + /^value_between_[+-]?\d+(?:\.\d+)?(?:[eE][+-]?\d+)?_and_[+-]?\d+(?:\.\d+)?(?:[eE][+-]?\d+)?$/, ).test(key) ) return ( @@ -64,9 +70,9 @@ export const test_json_createValidateParse_DynamicUnion = if (undefined === value) return true; if ( - RegExp( - /^[+-]?\d+(?:\.\d+)?(?:[eE][+-]?\d+)?$/, - ).test(key) + "number" === + typeof Number(key) && + Number.isFinite(Number(key)) ) return ( "string" === typeof value || @@ -78,9 +84,8 @@ export const test_json_createValidateParse_DynamicUnion = }) ); if ( - RegExp(/^(prefix_(.*))/).test( - key, - ) + "string" === typeof key && + RegExp(/^prefix_(.*)/).test(key) ) return ( "string" === typeof value || @@ -92,7 +97,8 @@ export const test_json_createValidateParse_DynamicUnion = }) ); if ( - RegExp(/((.*)_postfix)$/).test( + "string" === typeof key && + RegExp(/(.*)_postfix$/).test( key, ) ) @@ -106,8 +112,9 @@ export const test_json_createValidateParse_DynamicUnion = }) ); if ( + "string" === typeof key && RegExp( - /^(value_between_[+-]?\d+(?:\.\d+)?(?:[eE][+-]?\d+)?_and_[+-]?\d+(?:\.\d+)?(?:[eE][+-]?\d+)?)$/, + /^value_between_[+-]?\d+(?:\.\d+)?(?:[eE][+-]?\d+)?_and_[+-]?\d+(?:\.\d+)?(?:[eE][+-]?\d+)?$/, ).test(key) ) return ( diff --git a/test/generated/output/json.createValidateParse/test_json_createValidateParse_ObjectDynamic.ts b/test/generated/output/json.createValidateParse/test_json_createValidateParse_ObjectDynamic.ts index fc8fdb569a..77094298f7 100644 --- a/test/generated/output/json.createValidateParse/test_json_createValidateParse_ObjectDynamic.ts +++ b/test/generated/output/json.createValidateParse/test_json_createValidateParse_ObjectDynamic.ts @@ -12,7 +12,7 @@ export const test_json_createValidateParse_ObjectDynamic = Object.keys(input).every((key: any) => { const value = input[key]; if (undefined === value) return true; - if (RegExp(/(.*)/).test(key)) + if (true) return ( "string" === typeof value || ("number" === typeof value && @@ -51,7 +51,7 @@ export const test_json_createValidateParse_ObjectDynamic = const value = input[key]; if (undefined === value) return true; - if (RegExp(/(.*)/).test(key)) + if (true) return ( "string" === typeof value || ("number" === diff --git a/test/generated/output/json.createValidateParse/test_json_createValidateParse_UltimateUnion.ts b/test/generated/output/json.createValidateParse/test_json_createValidateParse_UltimateUnion.ts index 9b026d5306..215ac365cb 100644 --- a/test/generated/output/json.createValidateParse/test_json_createValidateParse_UltimateUnion.ts +++ b/test/generated/output/json.createValidateParse/test_json_createValidateParse_UltimateUnion.ts @@ -523,7 +523,7 @@ export const test_json_createValidateParse_UltimateUnion = Object.keys(input).every((key: any) => { const value = input[key]; if (undefined === value) return true; - if (RegExp(/(.*)/).test(key)) + if (true) return ( "object" === typeof value && null !== value && @@ -592,7 +592,7 @@ export const test_json_createValidateParse_UltimateUnion = Object.keys(input).every((key: any) => { const value = input[key]; if (undefined === value) return true; - if (RegExp(/(.*)/).test(key)) + if (true) return ( "object" === typeof value && null !== value && @@ -3792,7 +3792,7 @@ export const test_json_createValidateParse_UltimateUnion = const value = input[key]; if (undefined === value) return true; - if (RegExp(/(.*)/).test(key)) + if (true) return ( ((("object" === typeof value && @@ -4117,7 +4117,7 @@ export const test_json_createValidateParse_UltimateUnion = const value = input[key]; if (undefined === value) return true; - if (RegExp(/(.*)/).test(key)) + if (true) return ( ((("object" === typeof value && diff --git a/test/generated/output/json.createValidateStringify/test_json_createValidateStringify_DynamicComposite.ts b/test/generated/output/json.createValidateStringify/test_json_createValidateStringify_DynamicComposite.ts index 41810cd581..556e766127 100644 --- a/test/generated/output/json.createValidateStringify/test_json_createValidateStringify_DynamicComposite.ts +++ b/test/generated/output/json.createValidateStringify/test_json_createValidateStringify_DynamicComposite.ts @@ -18,21 +18,27 @@ export const test_json_createValidateStringify_DynamicComposite = const value = input[key]; if (undefined === value) return true; if ( - RegExp( - /^[+-]?\d+(?:\.\d+)?(?:[eE][+-]?\d+)?$/, - ).test(key) + "number" === typeof Number(key) && + Number.isFinite(Number(key)) ) return ( "number" === typeof value && Number.isFinite(value) ); - if (RegExp(/^(prefix_(.*))/).test(key)) + if ( + "string" === typeof key && + RegExp(/^prefix_(.*)/).test(key) + ) return "string" === typeof value; - if (RegExp(/((.*)_postfix)$/).test(key)) + if ( + "string" === typeof key && + RegExp(/(.*)_postfix$/).test(key) + ) return "string" === typeof value; if ( + "string" === typeof key && RegExp( - /^(value_[+-]?\d+(?:\.\d+)?(?:[eE][+-]?\d+)?)$/, + /^value_[+-]?\d+(?:\.\d+)?(?:[eE][+-]?\d+)?$/, ).test(key) ) return ( @@ -42,8 +48,9 @@ export const test_json_createValidateStringify_DynamicComposite = "boolean" === typeof value ); if ( + "string" === typeof key && RegExp( - /^(between_(.*)_and_[+-]?\d+(?:\.\d+)?(?:[eE][+-]?\d+)?)$/, + /^between_(.*)_and_[+-]?\d+(?:\.\d+)?(?:[eE][+-]?\d+)?$/, ).test(key) ) return "boolean" === typeof value; @@ -94,9 +101,8 @@ export const test_json_createValidateStringify_DynamicComposite = const value = input[key]; if (undefined === value) return true; if ( - RegExp( - /^[+-]?\d+(?:\.\d+)?(?:[eE][+-]?\d+)?$/, - ).test(key) + "number" === typeof Number(key) && + Number.isFinite(Number(key)) ) return ( ("number" === typeof value && @@ -107,7 +113,10 @@ export const test_json_createValidateStringify_DynamicComposite = value: value, }) ); - if (RegExp(/^(prefix_(.*))/).test(key)) + if ( + "string" === typeof key && + RegExp(/^prefix_(.*)/).test(key) + ) return ( "string" === typeof value || $report(_exceptionable, { @@ -116,7 +125,10 @@ export const test_json_createValidateStringify_DynamicComposite = value: value, }) ); - if (RegExp(/((.*)_postfix)$/).test(key)) + if ( + "string" === typeof key && + RegExp(/(.*)_postfix$/).test(key) + ) return ( "string" === typeof value || $report(_exceptionable, { @@ -126,8 +138,9 @@ export const test_json_createValidateStringify_DynamicComposite = }) ); if ( + "string" === typeof key && RegExp( - /^(value_[+-]?\d+(?:\.\d+)?(?:[eE][+-]?\d+)?)$/, + /^value_[+-]?\d+(?:\.\d+)?(?:[eE][+-]?\d+)?$/, ).test(key) ) return ( @@ -143,8 +156,9 @@ export const test_json_createValidateStringify_DynamicComposite = }) ); if ( + "string" === typeof key && RegExp( - /^(between_(.*)_and_[+-]?\d+(?:\.\d+)?(?:[eE][+-]?\d+)?)$/, + /^between_(.*)_and_[+-]?\d+(?:\.\d+)?(?:[eE][+-]?\d+)?$/, ).test(key) ) return ( diff --git a/test/generated/output/json.createValidateStringify/test_json_createValidateStringify_DynamicNever.ts b/test/generated/output/json.createValidateStringify/test_json_createValidateStringify_DynamicNever.ts index bd922bb50e..15754d967f 100644 --- a/test/generated/output/json.createValidateStringify/test_json_createValidateStringify_DynamicNever.ts +++ b/test/generated/output/json.createValidateStringify/test_json_createValidateStringify_DynamicNever.ts @@ -12,7 +12,7 @@ export const test_json_createValidateStringify_DynamicNever = Object.keys(input).every((key: any) => { const value = input[key]; if (undefined === value) return true; - if (RegExp(/(.*)/).test(key)) + if (true) return null !== value && undefined === value; return true; }); @@ -47,7 +47,7 @@ export const test_json_createValidateStringify_DynamicNever = const value = input[key]; if (undefined === value) return true; - if (RegExp(/(.*)/).test(key)) + if (true) return ( (null !== value || $report( diff --git a/test/generated/output/json.createValidateStringify/test_json_createValidateStringify_DynamicTemplate.ts b/test/generated/output/json.createValidateStringify/test_json_createValidateStringify_DynamicTemplate.ts index df90b49428..a255a64598 100644 --- a/test/generated/output/json.createValidateStringify/test_json_createValidateStringify_DynamicTemplate.ts +++ b/test/generated/output/json.createValidateStringify/test_json_createValidateStringify_DynamicTemplate.ts @@ -13,13 +13,20 @@ export const test_json_createValidateStringify_DynamicTemplate = Object.keys(input).every((key: any) => { const value = input[key]; if (undefined === value) return true; - if (RegExp(/^(prefix_(.*))/).test(key)) + if ( + "string" === typeof key && + RegExp(/^prefix_(.*)/).test(key) + ) return "string" === typeof value; - if (RegExp(/((.*)_postfix)$/).test(key)) + if ( + "string" === typeof key && + RegExp(/(.*)_postfix$/).test(key) + ) return "string" === typeof value; if ( + "string" === typeof key && RegExp( - /^(value_[+-]?\d+(?:\.\d+)?(?:[eE][+-]?\d+)?)$/, + /^value_[+-]?\d+(?:\.\d+)?(?:[eE][+-]?\d+)?$/, ).test(key) ) return ( @@ -27,8 +34,9 @@ export const test_json_createValidateStringify_DynamicTemplate = Number.isFinite(value) ); if ( + "string" === typeof key && RegExp( - /^(between_(.*)_and_[+-]?\d+(?:\.\d+)?(?:[eE][+-]?\d+)?)$/, + /^between_(.*)_and_[+-]?\d+(?:\.\d+)?(?:[eE][+-]?\d+)?$/, ).test(key) ) return "boolean" === typeof value; @@ -63,7 +71,10 @@ export const test_json_createValidateStringify_DynamicTemplate = .map((key: any) => { const value = input[key]; if (undefined === value) return true; - if (RegExp(/^(prefix_(.*))/).test(key)) + if ( + "string" === typeof key && + RegExp(/^prefix_(.*)/).test(key) + ) return ( "string" === typeof value || $report(_exceptionable, { @@ -72,7 +83,10 @@ export const test_json_createValidateStringify_DynamicTemplate = value: value, }) ); - if (RegExp(/((.*)_postfix)$/).test(key)) + if ( + "string" === typeof key && + RegExp(/(.*)_postfix$/).test(key) + ) return ( "string" === typeof value || $report(_exceptionable, { @@ -82,8 +96,9 @@ export const test_json_createValidateStringify_DynamicTemplate = }) ); if ( + "string" === typeof key && RegExp( - /^(value_[+-]?\d+(?:\.\d+)?(?:[eE][+-]?\d+)?)$/, + /^value_[+-]?\d+(?:\.\d+)?(?:[eE][+-]?\d+)?$/, ).test(key) ) return ( @@ -96,8 +111,9 @@ export const test_json_createValidateStringify_DynamicTemplate = }) ); if ( + "string" === typeof key && RegExp( - /^(between_(.*)_and_[+-]?\d+(?:\.\d+)?(?:[eE][+-]?\d+)?)$/, + /^between_(.*)_and_[+-]?\d+(?:\.\d+)?(?:[eE][+-]?\d+)?$/, ).test(key) ) return ( diff --git a/test/generated/output/json.createValidateStringify/test_json_createValidateStringify_DynamicTree.ts b/test/generated/output/json.createValidateStringify/test_json_createValidateStringify_DynamicTree.ts index 2871a2836e..ae72a2e4ce 100644 --- a/test/generated/output/json.createValidateStringify/test_json_createValidateStringify_DynamicTree.ts +++ b/test/generated/output/json.createValidateStringify/test_json_createValidateStringify_DynamicTree.ts @@ -20,7 +20,7 @@ export const test_json_createValidateStringify_DynamicTree = Object.keys(input).every((key: any) => { const value = input[key]; if (undefined === value) return true; - if (RegExp(/(.*)/).test(key)) + if (true) return ( "object" === typeof value && null !== value && @@ -96,7 +96,7 @@ export const test_json_createValidateStringify_DynamicTree = const value = input[key]; if (undefined === value) return true; - if (RegExp(/(.*)/).test(key)) + if (true) return ( ((("object" === typeof value && @@ -164,7 +164,7 @@ export const test_json_createValidateStringify_DynamicTree = Object.keys(input).every((key: any) => { const value = input[key]; if (undefined === value) return true; - if (RegExp(/(.*)/).test(key)) + if (true) return ( "object" === typeof value && null !== value && diff --git a/test/generated/output/json.createValidateStringify/test_json_createValidateStringify_DynamicUndefined.ts b/test/generated/output/json.createValidateStringify/test_json_createValidateStringify_DynamicUndefined.ts index 3c7883c993..9579293528 100644 --- a/test/generated/output/json.createValidateStringify/test_json_createValidateStringify_DynamicUndefined.ts +++ b/test/generated/output/json.createValidateStringify/test_json_createValidateStringify_DynamicUndefined.ts @@ -13,8 +13,7 @@ export const test_json_createValidateStringify_DynamicUndefined = Object.keys(input).every((key: any) => { const value = input[key]; if (undefined === value) return true; - if (RegExp(/(.*)/).test(key)) - return null !== value && undefined === value; + if (true) return null !== value && undefined === value; return true; }); return ( @@ -46,7 +45,7 @@ export const test_json_createValidateStringify_DynamicUndefined = .map((key: any) => { const value = input[key]; if (undefined === value) return true; - if (RegExp(/(.*)/).test(key)) + if (true) return ( (null !== value || $report(_exceptionable, { diff --git a/test/generated/output/json.createValidateStringify/test_json_createValidateStringify_DynamicUnion.ts b/test/generated/output/json.createValidateStringify/test_json_createValidateStringify_DynamicUnion.ts index d31970199f..43a351ce7d 100644 --- a/test/generated/output/json.createValidateStringify/test_json_createValidateStringify_DynamicUnion.ts +++ b/test/generated/output/json.createValidateStringify/test_json_createValidateStringify_DynamicUnion.ts @@ -13,18 +13,24 @@ export const test_json_createValidateStringify_DynamicUnion = const value = input[key]; if (undefined === value) return true; if ( - RegExp( - /^[+-]?\d+(?:\.\d+)?(?:[eE][+-]?\d+)?$/, - ).test(key) + "number" === typeof Number(key) && + Number.isFinite(Number(key)) ) return "string" === typeof value; - if (RegExp(/^(prefix_(.*))/).test(key)) + if ( + "string" === typeof key && + RegExp(/^prefix_(.*)/).test(key) + ) return "string" === typeof value; - if (RegExp(/((.*)_postfix)$/).test(key)) + if ( + "string" === typeof key && + RegExp(/(.*)_postfix$/).test(key) + ) return "string" === typeof value; if ( + "string" === typeof key && RegExp( - /^(value_between_[+-]?\d+(?:\.\d+)?(?:[eE][+-]?\d+)?_and_[+-]?\d+(?:\.\d+)?(?:[eE][+-]?\d+)?)$/, + /^value_between_[+-]?\d+(?:\.\d+)?(?:[eE][+-]?\d+)?_and_[+-]?\d+(?:\.\d+)?(?:[eE][+-]?\d+)?$/, ).test(key) ) return ( @@ -65,9 +71,9 @@ export const test_json_createValidateStringify_DynamicUnion = if (undefined === value) return true; if ( - RegExp( - /^[+-]?\d+(?:\.\d+)?(?:[eE][+-]?\d+)?$/, - ).test(key) + "number" === + typeof Number(key) && + Number.isFinite(Number(key)) ) return ( "string" === typeof value || @@ -79,9 +85,8 @@ export const test_json_createValidateStringify_DynamicUnion = }) ); if ( - RegExp(/^(prefix_(.*))/).test( - key, - ) + "string" === typeof key && + RegExp(/^prefix_(.*)/).test(key) ) return ( "string" === typeof value || @@ -93,7 +98,8 @@ export const test_json_createValidateStringify_DynamicUnion = }) ); if ( - RegExp(/((.*)_postfix)$/).test( + "string" === typeof key && + RegExp(/(.*)_postfix$/).test( key, ) ) @@ -107,8 +113,9 @@ export const test_json_createValidateStringify_DynamicUnion = }) ); if ( + "string" === typeof key && RegExp( - /^(value_between_[+-]?\d+(?:\.\d+)?(?:[eE][+-]?\d+)?_and_[+-]?\d+(?:\.\d+)?(?:[eE][+-]?\d+)?)$/, + /^value_between_[+-]?\d+(?:\.\d+)?(?:[eE][+-]?\d+)?_and_[+-]?\d+(?:\.\d+)?(?:[eE][+-]?\d+)?$/, ).test(key) ) return ( diff --git a/test/generated/output/json.createValidateStringify/test_json_createValidateStringify_ObjectDynamic.ts b/test/generated/output/json.createValidateStringify/test_json_createValidateStringify_ObjectDynamic.ts index d0e87b20f8..95d4d408e2 100644 --- a/test/generated/output/json.createValidateStringify/test_json_createValidateStringify_ObjectDynamic.ts +++ b/test/generated/output/json.createValidateStringify/test_json_createValidateStringify_ObjectDynamic.ts @@ -12,7 +12,7 @@ export const test_json_createValidateStringify_ObjectDynamic = Object.keys(input).every((key: any) => { const value = input[key]; if (undefined === value) return true; - if (RegExp(/(.*)/).test(key)) + if (true) return ( "string" === typeof value || ("number" === typeof value && @@ -52,7 +52,7 @@ export const test_json_createValidateStringify_ObjectDynamic = const value = input[key]; if (undefined === value) return true; - if (RegExp(/(.*)/).test(key)) + if (true) return ( "string" === typeof value || ("number" === diff --git a/test/generated/output/json.createValidateStringify/test_json_createValidateStringify_UltimateUnion.ts b/test/generated/output/json.createValidateStringify/test_json_createValidateStringify_UltimateUnion.ts index 7e5531aacb..6588fe1c62 100644 --- a/test/generated/output/json.createValidateStringify/test_json_createValidateStringify_UltimateUnion.ts +++ b/test/generated/output/json.createValidateStringify/test_json_createValidateStringify_UltimateUnion.ts @@ -523,7 +523,7 @@ export const test_json_createValidateStringify_UltimateUnion = Object.keys(input).every((key: any) => { const value = input[key]; if (undefined === value) return true; - if (RegExp(/(.*)/).test(key)) + if (true) return ( "object" === typeof value && null !== value && @@ -592,7 +592,7 @@ export const test_json_createValidateStringify_UltimateUnion = Object.keys(input).every((key: any) => { const value = input[key]; if (undefined === value) return true; - if (RegExp(/(.*)/).test(key)) + if (true) return ( "object" === typeof value && null !== value && @@ -3793,7 +3793,7 @@ export const test_json_createValidateStringify_UltimateUnion = const value = input[key]; if (undefined === value) return true; - if (RegExp(/(.*)/).test(key)) + if (true) return ( ((("object" === typeof value && @@ -4118,7 +4118,7 @@ export const test_json_createValidateStringify_UltimateUnion = const value = input[key]; if (undefined === value) return true; - if (RegExp(/(.*)/).test(key)) + if (true) return ( ((("object" === typeof value && @@ -7396,7 +7396,7 @@ export const test_json_createValidateStringify_UltimateUnion = Object.keys(input).every((key: any) => { const value = input[key]; if (undefined === value) return true; - if (RegExp(/(.*)/).test(key)) + if (true) return ( "object" === typeof value && null !== value && @@ -7463,7 +7463,7 @@ export const test_json_createValidateStringify_UltimateUnion = Object.keys(input).every((key: any) => { const value = input[key]; if (undefined === value) return true; - if (RegExp(/(.*)/).test(key)) + if (true) return ( "object" === typeof value && null !== value && diff --git a/test/generated/output/json.isParse/test_json_isParse_DynamicArray.ts b/test/generated/output/json.isParse/test_json_isParse_DynamicArray.ts index ef85bde2a4..80adbd9cf0 100644 --- a/test/generated/output/json.isParse/test_json_isParse_DynamicArray.ts +++ b/test/generated/output/json.isParse/test_json_isParse_DynamicArray.ts @@ -16,7 +16,7 @@ export const test_json_isParse_DynamicArray = _test_json_isParse( Object.keys(input).every((key: any) => { const value = input[key]; if (undefined === value) return true; - if (RegExp(/(.*)/).test(key)) + if (true) return ( Array.isArray(value) && value.every((elem: any) => "string" === typeof elem) diff --git a/test/generated/output/json.isParse/test_json_isParse_DynamicComposite.ts b/test/generated/output/json.isParse/test_json_isParse_DynamicComposite.ts index de16d1f233..cb10882604 100644 --- a/test/generated/output/json.isParse/test_json_isParse_DynamicComposite.ts +++ b/test/generated/output/json.isParse/test_json_isParse_DynamicComposite.ts @@ -16,20 +16,26 @@ export const test_json_isParse_DynamicComposite = _test_json_isParse( const value = input[key]; if (undefined === value) return true; if ( - RegExp(/^[+-]?\d+(?:\.\d+)?(?:[eE][+-]?\d+)?$/).test( - key, - ) + "number" === typeof Number(key) && + Number.isFinite(Number(key)) ) return ( "number" === typeof value && Number.isFinite(value) ); - if (RegExp(/^(prefix_(.*))/).test(key)) + if ( + "string" === typeof key && + RegExp(/^prefix_(.*)/).test(key) + ) return "string" === typeof value; - if (RegExp(/((.*)_postfix)$/).test(key)) + if ( + "string" === typeof key && + RegExp(/(.*)_postfix$/).test(key) + ) return "string" === typeof value; if ( + "string" === typeof key && RegExp( - /^(value_[+-]?\d+(?:\.\d+)?(?:[eE][+-]?\d+)?)$/, + /^value_[+-]?\d+(?:\.\d+)?(?:[eE][+-]?\d+)?$/, ).test(key) ) return ( @@ -39,8 +45,9 @@ export const test_json_isParse_DynamicComposite = _test_json_isParse( "boolean" === typeof value ); if ( + "string" === typeof key && RegExp( - /^(between_(.*)_and_[+-]?\d+(?:\.\d+)?(?:[eE][+-]?\d+)?)$/, + /^between_(.*)_and_[+-]?\d+(?:\.\d+)?(?:[eE][+-]?\d+)?$/, ).test(key) ) return "boolean" === typeof value; diff --git a/test/generated/output/json.isParse/test_json_isParse_DynamicNever.ts b/test/generated/output/json.isParse/test_json_isParse_DynamicNever.ts index ffb71fa3ae..07fab2cc45 100644 --- a/test/generated/output/json.isParse/test_json_isParse_DynamicNever.ts +++ b/test/generated/output/json.isParse/test_json_isParse_DynamicNever.ts @@ -11,8 +11,7 @@ export const test_json_isParse_DynamicNever = _test_json_isParse( Object.keys(input).every((key: any) => { const value = input[key]; if (undefined === value) return true; - if (RegExp(/(.*)/).test(key)) - return null !== value && undefined === value; + if (true) return null !== value && undefined === value; return true; }); return ( diff --git a/test/generated/output/json.isParse/test_json_isParse_DynamicSimple.ts b/test/generated/output/json.isParse/test_json_isParse_DynamicSimple.ts index b9d7c28670..5e7b4f8e76 100644 --- a/test/generated/output/json.isParse/test_json_isParse_DynamicSimple.ts +++ b/test/generated/output/json.isParse/test_json_isParse_DynamicSimple.ts @@ -16,7 +16,7 @@ export const test_json_isParse_DynamicSimple = _test_json_isParse( Object.keys(input).every((key: any) => { const value = input[key]; if (undefined === value) return true; - if (RegExp(/(.*)/).test(key)) + if (true) return ( "number" === typeof value && Number.isFinite(value) ); diff --git a/test/generated/output/json.isParse/test_json_isParse_DynamicTemplate.ts b/test/generated/output/json.isParse/test_json_isParse_DynamicTemplate.ts index 8fdc86f85e..3cb125a7ac 100644 --- a/test/generated/output/json.isParse/test_json_isParse_DynamicTemplate.ts +++ b/test/generated/output/json.isParse/test_json_isParse_DynamicTemplate.ts @@ -11,21 +11,29 @@ export const test_json_isParse_DynamicTemplate = _test_json_isParse( Object.keys(input).every((key: any) => { const value = input[key]; if (undefined === value) return true; - if (RegExp(/^(prefix_(.*))/).test(key)) + if ( + "string" === typeof key && + RegExp(/^prefix_(.*)/).test(key) + ) return "string" === typeof value; - if (RegExp(/((.*)_postfix)$/).test(key)) + if ( + "string" === typeof key && + RegExp(/(.*)_postfix$/).test(key) + ) return "string" === typeof value; if ( + "string" === typeof key && RegExp( - /^(value_[+-]?\d+(?:\.\d+)?(?:[eE][+-]?\d+)?)$/, + /^value_[+-]?\d+(?:\.\d+)?(?:[eE][+-]?\d+)?$/, ).test(key) ) return ( "number" === typeof value && Number.isFinite(value) ); if ( + "string" === typeof key && RegExp( - /^(between_(.*)_and_[+-]?\d+(?:\.\d+)?(?:[eE][+-]?\d+)?)$/, + /^between_(.*)_and_[+-]?\d+(?:\.\d+)?(?:[eE][+-]?\d+)?$/, ).test(key) ) return "boolean" === typeof value; diff --git a/test/generated/output/json.isParse/test_json_isParse_DynamicTree.ts b/test/generated/output/json.isParse/test_json_isParse_DynamicTree.ts index 7d7b65efe8..25205e10a7 100644 --- a/test/generated/output/json.isParse/test_json_isParse_DynamicTree.ts +++ b/test/generated/output/json.isParse/test_json_isParse_DynamicTree.ts @@ -19,7 +19,7 @@ export const test_json_isParse_DynamicTree = _test_json_isParse( Object.keys(input).every((key: any) => { const value = input[key]; if (undefined === value) return true; - if (RegExp(/(.*)/).test(key)) + if (true) return ( "object" === typeof value && null !== value && diff --git a/test/generated/output/json.isParse/test_json_isParse_DynamicUndefined.ts b/test/generated/output/json.isParse/test_json_isParse_DynamicUndefined.ts index 5ee62aaca0..8bf8e52d89 100644 --- a/test/generated/output/json.isParse/test_json_isParse_DynamicUndefined.ts +++ b/test/generated/output/json.isParse/test_json_isParse_DynamicUndefined.ts @@ -11,8 +11,7 @@ export const test_json_isParse_DynamicUndefined = _test_json_isParse( Object.keys(input).every((key: any) => { const value = input[key]; if (undefined === value) return true; - if (RegExp(/(.*)/).test(key)) - return null !== value && undefined === value; + if (true) return null !== value && undefined === value; return true; }); return ( diff --git a/test/generated/output/json.isParse/test_json_isParse_DynamicUnion.ts b/test/generated/output/json.isParse/test_json_isParse_DynamicUnion.ts index 852b1ca46a..0879ff31c4 100644 --- a/test/generated/output/json.isParse/test_json_isParse_DynamicUnion.ts +++ b/test/generated/output/json.isParse/test_json_isParse_DynamicUnion.ts @@ -12,18 +12,24 @@ export const test_json_isParse_DynamicUnion = _test_json_isParse( const value = input[key]; if (undefined === value) return true; if ( - RegExp(/^[+-]?\d+(?:\.\d+)?(?:[eE][+-]?\d+)?$/).test( - key, - ) + "number" === typeof Number(key) && + Number.isFinite(Number(key)) ) return "string" === typeof value; - if (RegExp(/^(prefix_(.*))/).test(key)) + if ( + "string" === typeof key && + RegExp(/^prefix_(.*)/).test(key) + ) return "string" === typeof value; - if (RegExp(/((.*)_postfix)$/).test(key)) + if ( + "string" === typeof key && + RegExp(/(.*)_postfix$/).test(key) + ) return "string" === typeof value; if ( + "string" === typeof key && RegExp( - /^(value_between_[+-]?\d+(?:\.\d+)?(?:[eE][+-]?\d+)?_and_[+-]?\d+(?:\.\d+)?(?:[eE][+-]?\d+)?)$/, + /^value_between_[+-]?\d+(?:\.\d+)?(?:[eE][+-]?\d+)?_and_[+-]?\d+(?:\.\d+)?(?:[eE][+-]?\d+)?$/, ).test(key) ) return ( diff --git a/test/generated/output/json.isParse/test_json_isParse_ObjectDynamic.ts b/test/generated/output/json.isParse/test_json_isParse_ObjectDynamic.ts index 01b54c8312..f981fb848d 100644 --- a/test/generated/output/json.isParse/test_json_isParse_ObjectDynamic.ts +++ b/test/generated/output/json.isParse/test_json_isParse_ObjectDynamic.ts @@ -11,7 +11,7 @@ export const test_json_isParse_ObjectDynamic = _test_json_isParse( Object.keys(input).every((key: any) => { const value = input[key]; if (undefined === value) return true; - if (RegExp(/(.*)/).test(key)) + if (true) return ( "string" === typeof value || ("number" === typeof value && diff --git a/test/generated/output/json.isParse/test_json_isParse_UltimateUnion.ts b/test/generated/output/json.isParse/test_json_isParse_UltimateUnion.ts index 6a106365b9..a3e138cd61 100644 --- a/test/generated/output/json.isParse/test_json_isParse_UltimateUnion.ts +++ b/test/generated/output/json.isParse/test_json_isParse_UltimateUnion.ts @@ -513,7 +513,7 @@ export const test_json_isParse_UltimateUnion = _test_json_isParse( Object.keys(input).every((key: any) => { const value = input[key]; if (undefined === value) return true; - if (RegExp(/(.*)/).test(key)) + if (true) return ( "object" === typeof value && null !== value && @@ -575,7 +575,7 @@ export const test_json_isParse_UltimateUnion = _test_json_isParse( Object.keys(input).every((key: any) => { const value = input[key]; if (undefined === value) return true; - if (RegExp(/(.*)/).test(key)) + if (true) return ( "object" === typeof value && null !== value && diff --git a/test/generated/output/json.isStringify/test_json_isStringify_DynamicArray.ts b/test/generated/output/json.isStringify/test_json_isStringify_DynamicArray.ts index 09dbf1f6f9..f2741c3249 100644 --- a/test/generated/output/json.isStringify/test_json_isStringify_DynamicArray.ts +++ b/test/generated/output/json.isStringify/test_json_isStringify_DynamicArray.ts @@ -16,7 +16,7 @@ export const test_json_isStringify_DynamicArray = _test_json_isStringify( Object.keys(input).every((key: any) => { const value = input[key]; if (undefined === value) return true; - if (RegExp(/(.*)/).test(key)) + if (true) return ( Array.isArray(value) && value.every((elem: any) => "string" === typeof elem) @@ -30,7 +30,7 @@ export const test_json_isStringify_DynamicArray = _test_json_isStringify( Object.keys(input).every((key: any) => { const value = input[key]; if (undefined === value) return true; - if (RegExp(/(.*)/).test(key)) + if (true) return ( Array.isArray(value) && value.every((elem: any) => "string" === typeof elem) diff --git a/test/generated/output/json.isStringify/test_json_isStringify_DynamicComposite.ts b/test/generated/output/json.isStringify/test_json_isStringify_DynamicComposite.ts index 8f4c27c2d7..749dcfc041 100644 --- a/test/generated/output/json.isStringify/test_json_isStringify_DynamicComposite.ts +++ b/test/generated/output/json.isStringify/test_json_isStringify_DynamicComposite.ts @@ -16,20 +16,26 @@ export const test_json_isStringify_DynamicComposite = _test_json_isStringify( const value = input[key]; if (undefined === value) return true; if ( - RegExp(/^[+-]?\d+(?:\.\d+)?(?:[eE][+-]?\d+)?$/).test( - key, - ) + "number" === typeof Number(key) && + Number.isFinite(Number(key)) ) return ( "number" === typeof value && Number.isFinite(value) ); - if (RegExp(/^(prefix_(.*))/).test(key)) + if ( + "string" === typeof key && + RegExp(/^prefix_(.*)/).test(key) + ) return "string" === typeof value; - if (RegExp(/((.*)_postfix)$/).test(key)) + if ( + "string" === typeof key && + RegExp(/(.*)_postfix$/).test(key) + ) return "string" === typeof value; if ( + "string" === typeof key && RegExp( - /^(value_[+-]?\d+(?:\.\d+)?(?:[eE][+-]?\d+)?)$/, + /^value_[+-]?\d+(?:\.\d+)?(?:[eE][+-]?\d+)?$/, ).test(key) ) return ( @@ -39,8 +45,9 @@ export const test_json_isStringify_DynamicComposite = _test_json_isStringify( "boolean" === typeof value ); if ( + "string" === typeof key && RegExp( - /^(between_(.*)_and_[+-]?\d+(?:\.\d+)?(?:[eE][+-]?\d+)?)$/, + /^between_(.*)_and_[+-]?\d+(?:\.\d+)?(?:[eE][+-]?\d+)?$/, ).test(key) ) return "boolean" === typeof value; diff --git a/test/generated/output/json.isStringify/test_json_isStringify_DynamicNever.ts b/test/generated/output/json.isStringify/test_json_isStringify_DynamicNever.ts index 218165d285..b38a1f2efd 100644 --- a/test/generated/output/json.isStringify/test_json_isStringify_DynamicNever.ts +++ b/test/generated/output/json.isStringify/test_json_isStringify_DynamicNever.ts @@ -11,8 +11,7 @@ export const test_json_isStringify_DynamicNever = _test_json_isStringify( Object.keys(input).every((key: any) => { const value = input[key]; if (undefined === value) return true; - if (RegExp(/(.*)/).test(key)) - return null !== value && undefined === value; + if (true) return null !== value && undefined === value; return true; }); return ( diff --git a/test/generated/output/json.isStringify/test_json_isStringify_DynamicSimple.ts b/test/generated/output/json.isStringify/test_json_isStringify_DynamicSimple.ts index 34cb1ab6b4..d45c5351cd 100644 --- a/test/generated/output/json.isStringify/test_json_isStringify_DynamicSimple.ts +++ b/test/generated/output/json.isStringify/test_json_isStringify_DynamicSimple.ts @@ -16,7 +16,7 @@ export const test_json_isStringify_DynamicSimple = _test_json_isStringify( Object.keys(input).every((key: any) => { const value = input[key]; if (undefined === value) return true; - if (RegExp(/(.*)/).test(key)) + if (true) return ( "number" === typeof value && Number.isFinite(value) ); @@ -29,8 +29,7 @@ export const test_json_isStringify_DynamicSimple = _test_json_isStringify( Object.keys(input).every((key: any) => { const value = input[key]; if (undefined === value) return true; - if (RegExp(/(.*)/).test(key)) - return "number" === typeof value; + if (true) return "number" === typeof value; return true; }); const $number = (typia.json.isStringify as any).number; diff --git a/test/generated/output/json.isStringify/test_json_isStringify_DynamicTemplate.ts b/test/generated/output/json.isStringify/test_json_isStringify_DynamicTemplate.ts index 577b70ff6b..e2e32eed32 100644 --- a/test/generated/output/json.isStringify/test_json_isStringify_DynamicTemplate.ts +++ b/test/generated/output/json.isStringify/test_json_isStringify_DynamicTemplate.ts @@ -11,21 +11,29 @@ export const test_json_isStringify_DynamicTemplate = _test_json_isStringify( Object.keys(input).every((key: any) => { const value = input[key]; if (undefined === value) return true; - if (RegExp(/^(prefix_(.*))/).test(key)) + if ( + "string" === typeof key && + RegExp(/^prefix_(.*)/).test(key) + ) return "string" === typeof value; - if (RegExp(/((.*)_postfix)$/).test(key)) + if ( + "string" === typeof key && + RegExp(/(.*)_postfix$/).test(key) + ) return "string" === typeof value; if ( + "string" === typeof key && RegExp( - /^(value_[+-]?\d+(?:\.\d+)?(?:[eE][+-]?\d+)?)$/, + /^value_[+-]?\d+(?:\.\d+)?(?:[eE][+-]?\d+)?$/, ).test(key) ) return ( "number" === typeof value && Number.isFinite(value) ); if ( + "string" === typeof key && RegExp( - /^(between_(.*)_and_[+-]?\d+(?:\.\d+)?(?:[eE][+-]?\d+)?)$/, + /^between_(.*)_and_[+-]?\d+(?:\.\d+)?(?:[eE][+-]?\d+)?$/, ).test(key) ) return "boolean" === typeof value; diff --git a/test/generated/output/json.isStringify/test_json_isStringify_DynamicTree.ts b/test/generated/output/json.isStringify/test_json_isStringify_DynamicTree.ts index fd20f30913..dfb7f0e9a7 100644 --- a/test/generated/output/json.isStringify/test_json_isStringify_DynamicTree.ts +++ b/test/generated/output/json.isStringify/test_json_isStringify_DynamicTree.ts @@ -19,7 +19,7 @@ export const test_json_isStringify_DynamicTree = _test_json_isStringify( Object.keys(input).every((key: any) => { const value = input[key]; if (undefined === value) return true; - if (RegExp(/(.*)/).test(key)) + if (true) return ( "object" === typeof value && null !== value && @@ -41,7 +41,7 @@ export const test_json_isStringify_DynamicTree = _test_json_isStringify( Object.keys(input).every((key: any) => { const value = input[key]; if (undefined === value) return true; - if (RegExp(/(.*)/).test(key)) + if (true) return ( "object" === typeof value && null !== value && diff --git a/test/generated/output/json.isStringify/test_json_isStringify_DynamicUndefined.ts b/test/generated/output/json.isStringify/test_json_isStringify_DynamicUndefined.ts index 4c044db717..e992ac3314 100644 --- a/test/generated/output/json.isStringify/test_json_isStringify_DynamicUndefined.ts +++ b/test/generated/output/json.isStringify/test_json_isStringify_DynamicUndefined.ts @@ -11,8 +11,7 @@ export const test_json_isStringify_DynamicUndefined = _test_json_isStringify( Object.keys(input).every((key: any) => { const value = input[key]; if (undefined === value) return true; - if (RegExp(/(.*)/).test(key)) - return null !== value && undefined === value; + if (true) return null !== value && undefined === value; return true; }); return ( diff --git a/test/generated/output/json.isStringify/test_json_isStringify_DynamicUnion.ts b/test/generated/output/json.isStringify/test_json_isStringify_DynamicUnion.ts index 7bafc2aa69..7109d12ce5 100644 --- a/test/generated/output/json.isStringify/test_json_isStringify_DynamicUnion.ts +++ b/test/generated/output/json.isStringify/test_json_isStringify_DynamicUnion.ts @@ -12,18 +12,24 @@ export const test_json_isStringify_DynamicUnion = _test_json_isStringify( const value = input[key]; if (undefined === value) return true; if ( - RegExp(/^[+-]?\d+(?:\.\d+)?(?:[eE][+-]?\d+)?$/).test( - key, - ) + "number" === typeof Number(key) && + Number.isFinite(Number(key)) ) return "string" === typeof value; - if (RegExp(/^(prefix_(.*))/).test(key)) + if ( + "string" === typeof key && + RegExp(/^prefix_(.*)/).test(key) + ) return "string" === typeof value; - if (RegExp(/((.*)_postfix)$/).test(key)) + if ( + "string" === typeof key && + RegExp(/(.*)_postfix$/).test(key) + ) return "string" === typeof value; if ( + "string" === typeof key && RegExp( - /^(value_between_[+-]?\d+(?:\.\d+)?(?:[eE][+-]?\d+)?_and_[+-]?\d+(?:\.\d+)?(?:[eE][+-]?\d+)?)$/, + /^value_between_[+-]?\d+(?:\.\d+)?(?:[eE][+-]?\d+)?_and_[+-]?\d+(?:\.\d+)?(?:[eE][+-]?\d+)?$/, ).test(key) ) return ( diff --git a/test/generated/output/json.isStringify/test_json_isStringify_ObjectDynamic.ts b/test/generated/output/json.isStringify/test_json_isStringify_ObjectDynamic.ts index 67f6d1ee94..9902274620 100644 --- a/test/generated/output/json.isStringify/test_json_isStringify_ObjectDynamic.ts +++ b/test/generated/output/json.isStringify/test_json_isStringify_ObjectDynamic.ts @@ -11,7 +11,7 @@ export const test_json_isStringify_ObjectDynamic = _test_json_isStringify( Object.keys(input).every((key: any) => { const value = input[key]; if (undefined === value) return true; - if (RegExp(/(.*)/).test(key)) + if (true) return ( "string" === typeof value || ("number" === typeof value && diff --git a/test/generated/output/json.isStringify/test_json_isStringify_UltimateUnion.ts b/test/generated/output/json.isStringify/test_json_isStringify_UltimateUnion.ts index c0677475eb..e5ed244171 100644 --- a/test/generated/output/json.isStringify/test_json_isStringify_UltimateUnion.ts +++ b/test/generated/output/json.isStringify/test_json_isStringify_UltimateUnion.ts @@ -513,7 +513,7 @@ export const test_json_isStringify_UltimateUnion = _test_json_isStringify( Object.keys(input).every((key: any) => { const value = input[key]; if (undefined === value) return true; - if (RegExp(/(.*)/).test(key)) + if (true) return ( "object" === typeof value && null !== value && @@ -575,7 +575,7 @@ export const test_json_isStringify_UltimateUnion = _test_json_isStringify( Object.keys(input).every((key: any) => { const value = input[key]; if (undefined === value) return true; - if (RegExp(/(.*)/).test(key)) + if (true) return ( "object" === typeof value && null !== value && @@ -1639,7 +1639,7 @@ export const test_json_isStringify_UltimateUnion = _test_json_isStringify( Object.keys(input).every((key: any) => { const value = input[key]; if (undefined === value) return true; - if (RegExp(/(.*)/).test(key)) + if (true) return ( "object" === typeof value && null !== value && @@ -1701,7 +1701,7 @@ export const test_json_isStringify_UltimateUnion = _test_json_isStringify( Object.keys(input).every((key: any) => { const value = input[key]; if (undefined === value) return true; - if (RegExp(/(.*)/).test(key)) + if (true) return ( "object" === typeof value && null !== value && diff --git a/test/generated/output/json.stringify/test_json_stringify_DynamicArray.ts b/test/generated/output/json.stringify/test_json_stringify_DynamicArray.ts index a7181cab40..ecdcc054a1 100644 --- a/test/generated/output/json.stringify/test_json_stringify_DynamicArray.ts +++ b/test/generated/output/json.stringify/test_json_stringify_DynamicArray.ts @@ -10,7 +10,7 @@ export const test_json_stringify_DynamicArray = _test_json_stringify( Object.keys(input).every((key: any) => { const value = input[key]; if (undefined === value) return true; - if (RegExp(/(.*)/).test(key)) + if (true) return ( Array.isArray(value) && value.every((elem: any) => "string" === typeof elem) diff --git a/test/generated/output/json.stringify/test_json_stringify_DynamicSimple.ts b/test/generated/output/json.stringify/test_json_stringify_DynamicSimple.ts index 9a9dc853e4..cc7cf9069b 100644 --- a/test/generated/output/json.stringify/test_json_stringify_DynamicSimple.ts +++ b/test/generated/output/json.stringify/test_json_stringify_DynamicSimple.ts @@ -10,7 +10,7 @@ export const test_json_stringify_DynamicSimple = _test_json_stringify( Object.keys(input).every((key: any) => { const value = input[key]; if (undefined === value) return true; - if (RegExp(/(.*)/).test(key)) return "number" === typeof value; + if (true) return "number" === typeof value; return true; }); const $number = (typia.json.stringify as any).number; diff --git a/test/generated/output/json.stringify/test_json_stringify_DynamicTree.ts b/test/generated/output/json.stringify/test_json_stringify_DynamicTree.ts index 8cfa593714..75a4e27061 100644 --- a/test/generated/output/json.stringify/test_json_stringify_DynamicTree.ts +++ b/test/generated/output/json.stringify/test_json_stringify_DynamicTree.ts @@ -17,7 +17,7 @@ export const test_json_stringify_DynamicTree = _test_json_stringify( Object.keys(input).every((key: any) => { const value = input[key]; if (undefined === value) return true; - if (RegExp(/(.*)/).test(key)) + if (true) return ( "object" === typeof value && null !== value && diff --git a/test/generated/output/json.stringify/test_json_stringify_UltimateUnion.ts b/test/generated/output/json.stringify/test_json_stringify_UltimateUnion.ts index 9fcda6d95e..bed0511c22 100644 --- a/test/generated/output/json.stringify/test_json_stringify_UltimateUnion.ts +++ b/test/generated/output/json.stringify/test_json_stringify_UltimateUnion.ts @@ -474,7 +474,7 @@ export const test_json_stringify_UltimateUnion = _test_json_stringify( Object.keys(input).every((key: any) => { const value = input[key]; if (undefined === value) return true; - if (RegExp(/(.*)/).test(key)) + if (true) return ( "object" === typeof value && null !== value && @@ -533,7 +533,7 @@ export const test_json_stringify_UltimateUnion = _test_json_stringify( Object.keys(input).every((key: any) => { const value = input[key]; if (undefined === value) return true; - if (RegExp(/(.*)/).test(key)) + if (true) return ( "object" === typeof value && null !== value && diff --git a/test/generated/output/json.validateParse/test_json_validateParse_DynamicComposite.ts b/test/generated/output/json.validateParse/test_json_validateParse_DynamicComposite.ts index 224d6e0007..26b94af758 100644 --- a/test/generated/output/json.validateParse/test_json_validateParse_DynamicComposite.ts +++ b/test/generated/output/json.validateParse/test_json_validateParse_DynamicComposite.ts @@ -25,21 +25,27 @@ export const test_json_validateParse_DynamicComposite = const value = input[key]; if (undefined === value) return true; if ( - RegExp( - /^[+-]?\d+(?:\.\d+)?(?:[eE][+-]?\d+)?$/, - ).test(key) + "number" === typeof Number(key) && + Number.isFinite(Number(key)) ) return ( "number" === typeof value && Number.isFinite(value) ); - if (RegExp(/^(prefix_(.*))/).test(key)) + if ( + "string" === typeof key && + RegExp(/^prefix_(.*)/).test(key) + ) return "string" === typeof value; - if (RegExp(/((.*)_postfix)$/).test(key)) + if ( + "string" === typeof key && + RegExp(/(.*)_postfix$/).test(key) + ) return "string" === typeof value; if ( + "string" === typeof key && RegExp( - /^(value_[+-]?\d+(?:\.\d+)?(?:[eE][+-]?\d+)?)$/, + /^value_[+-]?\d+(?:\.\d+)?(?:[eE][+-]?\d+)?$/, ).test(key) ) return ( @@ -49,8 +55,9 @@ export const test_json_validateParse_DynamicComposite = "boolean" === typeof value ); if ( + "string" === typeof key && RegExp( - /^(between_(.*)_and_[+-]?\d+(?:\.\d+)?(?:[eE][+-]?\d+)?)$/, + /^between_(.*)_and_[+-]?\d+(?:\.\d+)?(?:[eE][+-]?\d+)?$/, ).test(key) ) return "boolean" === typeof value; @@ -103,9 +110,9 @@ export const test_json_validateParse_DynamicComposite = if (undefined === value) return true; if ( - RegExp( - /^[+-]?\d+(?:\.\d+)?(?:[eE][+-]?\d+)?$/, - ).test(key) + "number" === + typeof Number(key) && + Number.isFinite(Number(key)) ) return ( ("number" === @@ -121,9 +128,8 @@ export const test_json_validateParse_DynamicComposite = }) ); if ( - RegExp(/^(prefix_(.*))/).test( - key, - ) + "string" === typeof key && + RegExp(/^prefix_(.*)/).test(key) ) return ( "string" === typeof value || @@ -135,7 +141,8 @@ export const test_json_validateParse_DynamicComposite = }) ); if ( - RegExp(/((.*)_postfix)$/).test( + "string" === typeof key && + RegExp(/(.*)_postfix$/).test( key, ) ) @@ -149,8 +156,9 @@ export const test_json_validateParse_DynamicComposite = }) ); if ( + "string" === typeof key && RegExp( - /^(value_[+-]?\d+(?:\.\d+)?(?:[eE][+-]?\d+)?)$/, + /^value_[+-]?\d+(?:\.\d+)?(?:[eE][+-]?\d+)?$/, ).test(key) ) return ( @@ -171,8 +179,9 @@ export const test_json_validateParse_DynamicComposite = }) ); if ( + "string" === typeof key && RegExp( - /^(between_(.*)_and_[+-]?\d+(?:\.\d+)?(?:[eE][+-]?\d+)?)$/, + /^between_(.*)_and_[+-]?\d+(?:\.\d+)?(?:[eE][+-]?\d+)?$/, ).test(key) ) return ( diff --git a/test/generated/output/json.validateParse/test_json_validateParse_DynamicNever.ts b/test/generated/output/json.validateParse/test_json_validateParse_DynamicNever.ts index 9cebb9a582..7fb6326fe8 100644 --- a/test/generated/output/json.validateParse/test_json_validateParse_DynamicNever.ts +++ b/test/generated/output/json.validateParse/test_json_validateParse_DynamicNever.ts @@ -13,8 +13,7 @@ export const test_json_validateParse_DynamicNever = _test_json_validateParse( Object.keys(input).every((key: any) => { const value = input[key]; if (undefined === value) return true; - if (RegExp(/(.*)/).test(key)) - return null !== value && undefined === value; + if (true) return null !== value && undefined === value; return true; }); return ( @@ -45,7 +44,7 @@ export const test_json_validateParse_DynamicNever = _test_json_validateParse( .map((key: any) => { const value = input[key]; if (undefined === value) return true; - if (RegExp(/(.*)/).test(key)) + if (true) return ( (null !== value || $report(_exceptionable, { diff --git a/test/generated/output/json.validateParse/test_json_validateParse_DynamicTemplate.ts b/test/generated/output/json.validateParse/test_json_validateParse_DynamicTemplate.ts index c4546d364a..4f4dc9b1dd 100644 --- a/test/generated/output/json.validateParse/test_json_validateParse_DynamicTemplate.ts +++ b/test/generated/output/json.validateParse/test_json_validateParse_DynamicTemplate.ts @@ -13,13 +13,20 @@ export const test_json_validateParse_DynamicTemplate = _test_json_validateParse( Object.keys(input).every((key: any) => { const value = input[key]; if (undefined === value) return true; - if (RegExp(/^(prefix_(.*))/).test(key)) + if ( + "string" === typeof key && + RegExp(/^prefix_(.*)/).test(key) + ) return "string" === typeof value; - if (RegExp(/((.*)_postfix)$/).test(key)) + if ( + "string" === typeof key && + RegExp(/(.*)_postfix$/).test(key) + ) return "string" === typeof value; if ( + "string" === typeof key && RegExp( - /^(value_[+-]?\d+(?:\.\d+)?(?:[eE][+-]?\d+)?)$/, + /^value_[+-]?\d+(?:\.\d+)?(?:[eE][+-]?\d+)?$/, ).test(key) ) return ( @@ -27,8 +34,9 @@ export const test_json_validateParse_DynamicTemplate = _test_json_validateParse( Number.isFinite(value) ); if ( + "string" === typeof key && RegExp( - /^(between_(.*)_and_[+-]?\d+(?:\.\d+)?(?:[eE][+-]?\d+)?)$/, + /^between_(.*)_and_[+-]?\d+(?:\.\d+)?(?:[eE][+-]?\d+)?$/, ).test(key) ) return "boolean" === typeof value; @@ -62,7 +70,10 @@ export const test_json_validateParse_DynamicTemplate = _test_json_validateParse( .map((key: any) => { const value = input[key]; if (undefined === value) return true; - if (RegExp(/^(prefix_(.*))/).test(key)) + if ( + "string" === typeof key && + RegExp(/^prefix_(.*)/).test(key) + ) return ( "string" === typeof value || $report(_exceptionable, { @@ -71,7 +82,10 @@ export const test_json_validateParse_DynamicTemplate = _test_json_validateParse( value: value, }) ); - if (RegExp(/((.*)_postfix)$/).test(key)) + if ( + "string" === typeof key && + RegExp(/(.*)_postfix$/).test(key) + ) return ( "string" === typeof value || $report(_exceptionable, { @@ -81,8 +95,9 @@ export const test_json_validateParse_DynamicTemplate = _test_json_validateParse( }) ); if ( + "string" === typeof key && RegExp( - /^(value_[+-]?\d+(?:\.\d+)?(?:[eE][+-]?\d+)?)$/, + /^value_[+-]?\d+(?:\.\d+)?(?:[eE][+-]?\d+)?$/, ).test(key) ) return ( @@ -95,8 +110,9 @@ export const test_json_validateParse_DynamicTemplate = _test_json_validateParse( }) ); if ( + "string" === typeof key && RegExp( - /^(between_(.*)_and_[+-]?\d+(?:\.\d+)?(?:[eE][+-]?\d+)?)$/, + /^between_(.*)_and_[+-]?\d+(?:\.\d+)?(?:[eE][+-]?\d+)?$/, ).test(key) ) return ( diff --git a/test/generated/output/json.validateParse/test_json_validateParse_DynamicTree.ts b/test/generated/output/json.validateParse/test_json_validateParse_DynamicTree.ts index 049a9fb7f8..fd768c2582 100644 --- a/test/generated/output/json.validateParse/test_json_validateParse_DynamicTree.ts +++ b/test/generated/output/json.validateParse/test_json_validateParse_DynamicTree.ts @@ -21,7 +21,7 @@ export const test_json_validateParse_DynamicTree = _test_json_validateParse( Object.keys(input).every((key: any) => { const value = input[key]; if (undefined === value) return true; - if (RegExp(/(.*)/).test(key)) + if (true) return ( "object" === typeof value && null !== value && @@ -92,7 +92,7 @@ export const test_json_validateParse_DynamicTree = _test_json_validateParse( .map((key: any) => { const value = input[key]; if (undefined === value) return true; - if (RegExp(/(.*)/).test(key)) + if (true) return ( ((("object" === typeof value && null !== value) || diff --git a/test/generated/output/json.validateParse/test_json_validateParse_DynamicUndefined.ts b/test/generated/output/json.validateParse/test_json_validateParse_DynamicUndefined.ts index fc18b10f2d..1e7fc3e026 100644 --- a/test/generated/output/json.validateParse/test_json_validateParse_DynamicUndefined.ts +++ b/test/generated/output/json.validateParse/test_json_validateParse_DynamicUndefined.ts @@ -18,7 +18,7 @@ export const test_json_validateParse_DynamicUndefined = Object.keys(input).every((key: any) => { const value = input[key]; if (undefined === value) return true; - if (RegExp(/(.*)/).test(key)) + if (true) return null !== value && undefined === value; return true; }); @@ -51,7 +51,7 @@ export const test_json_validateParse_DynamicUndefined = const value = input[key]; if (undefined === value) return true; - if (RegExp(/(.*)/).test(key)) + if (true) return ( (null !== value || $report( diff --git a/test/generated/output/json.validateParse/test_json_validateParse_DynamicUnion.ts b/test/generated/output/json.validateParse/test_json_validateParse_DynamicUnion.ts index 892ea015d8..4d1a329b2f 100644 --- a/test/generated/output/json.validateParse/test_json_validateParse_DynamicUnion.ts +++ b/test/generated/output/json.validateParse/test_json_validateParse_DynamicUnion.ts @@ -14,18 +14,24 @@ export const test_json_validateParse_DynamicUnion = _test_json_validateParse( const value = input[key]; if (undefined === value) return true; if ( - RegExp( - /^[+-]?\d+(?:\.\d+)?(?:[eE][+-]?\d+)?$/, - ).test(key) + "number" === typeof Number(key) && + Number.isFinite(Number(key)) ) return "string" === typeof value; - if (RegExp(/^(prefix_(.*))/).test(key)) + if ( + "string" === typeof key && + RegExp(/^prefix_(.*)/).test(key) + ) return "string" === typeof value; - if (RegExp(/((.*)_postfix)$/).test(key)) + if ( + "string" === typeof key && + RegExp(/(.*)_postfix$/).test(key) + ) return "string" === typeof value; if ( + "string" === typeof key && RegExp( - /^(value_between_[+-]?\d+(?:\.\d+)?(?:[eE][+-]?\d+)?_and_[+-]?\d+(?:\.\d+)?(?:[eE][+-]?\d+)?)$/, + /^value_between_[+-]?\d+(?:\.\d+)?(?:[eE][+-]?\d+)?_and_[+-]?\d+(?:\.\d+)?(?:[eE][+-]?\d+)?$/, ).test(key) ) return ( @@ -63,9 +69,8 @@ export const test_json_validateParse_DynamicUnion = _test_json_validateParse( const value = input[key]; if (undefined === value) return true; if ( - RegExp( - /^[+-]?\d+(?:\.\d+)?(?:[eE][+-]?\d+)?$/, - ).test(key) + "number" === typeof Number(key) && + Number.isFinite(Number(key)) ) return ( "string" === typeof value || @@ -75,7 +80,10 @@ export const test_json_validateParse_DynamicUnion = _test_json_validateParse( value: value, }) ); - if (RegExp(/^(prefix_(.*))/).test(key)) + if ( + "string" === typeof key && + RegExp(/^prefix_(.*)/).test(key) + ) return ( "string" === typeof value || $report(_exceptionable, { @@ -84,7 +92,10 @@ export const test_json_validateParse_DynamicUnion = _test_json_validateParse( value: value, }) ); - if (RegExp(/((.*)_postfix)$/).test(key)) + if ( + "string" === typeof key && + RegExp(/(.*)_postfix$/).test(key) + ) return ( "string" === typeof value || $report(_exceptionable, { @@ -94,8 +105,9 @@ export const test_json_validateParse_DynamicUnion = _test_json_validateParse( }) ); if ( + "string" === typeof key && RegExp( - /^(value_between_[+-]?\d+(?:\.\d+)?(?:[eE][+-]?\d+)?_and_[+-]?\d+(?:\.\d+)?(?:[eE][+-]?\d+)?)$/, + /^value_between_[+-]?\d+(?:\.\d+)?(?:[eE][+-]?\d+)?_and_[+-]?\d+(?:\.\d+)?(?:[eE][+-]?\d+)?$/, ).test(key) ) return ( diff --git a/test/generated/output/json.validateParse/test_json_validateParse_ObjectDynamic.ts b/test/generated/output/json.validateParse/test_json_validateParse_ObjectDynamic.ts index e7b90deee2..8c7f05e643 100644 --- a/test/generated/output/json.validateParse/test_json_validateParse_ObjectDynamic.ts +++ b/test/generated/output/json.validateParse/test_json_validateParse_ObjectDynamic.ts @@ -13,7 +13,7 @@ export const test_json_validateParse_ObjectDynamic = _test_json_validateParse( Object.keys(input).every((key: any) => { const value = input[key]; if (undefined === value) return true; - if (RegExp(/(.*)/).test(key)) + if (true) return ( "string" === typeof value || ("number" === typeof value && @@ -50,7 +50,7 @@ export const test_json_validateParse_ObjectDynamic = _test_json_validateParse( .map((key: any) => { const value = input[key]; if (undefined === value) return true; - if (RegExp(/(.*)/).test(key)) + if (true) return ( "string" === typeof value || ("number" === typeof value && diff --git a/test/generated/output/json.validateParse/test_json_validateParse_UltimateUnion.ts b/test/generated/output/json.validateParse/test_json_validateParse_UltimateUnion.ts index 6b82862f55..afe9c72557 100644 --- a/test/generated/output/json.validateParse/test_json_validateParse_UltimateUnion.ts +++ b/test/generated/output/json.validateParse/test_json_validateParse_UltimateUnion.ts @@ -519,7 +519,7 @@ export const test_json_validateParse_UltimateUnion = _test_json_validateParse( Object.keys(input).every((key: any) => { const value = input[key]; if (undefined === value) return true; - if (RegExp(/(.*)/).test(key)) + if (true) return ( "object" === typeof value && null !== value && @@ -586,7 +586,7 @@ export const test_json_validateParse_UltimateUnion = _test_json_validateParse( Object.keys(input).every((key: any) => { const value = input[key]; if (undefined === value) return true; - if (RegExp(/(.*)/).test(key)) + if (true) return ( "object" === typeof value && null !== value && @@ -3581,7 +3581,7 @@ export const test_json_validateParse_UltimateUnion = _test_json_validateParse( .map((key: any) => { const value = input[key]; if (undefined === value) return true; - if (RegExp(/(.*)/).test(key)) + if (true) return ( ((("object" === typeof value && null !== value && @@ -3869,7 +3869,7 @@ export const test_json_validateParse_UltimateUnion = _test_json_validateParse( .map((key: any) => { const value = input[key]; if (undefined === value) return true; - if (RegExp(/(.*)/).test(key)) + if (true) return ( ((("object" === typeof value && null !== value && diff --git a/test/generated/output/json.validateStringify/test_json_validateStringify_DynamicComposite.ts b/test/generated/output/json.validateStringify/test_json_validateStringify_DynamicComposite.ts index 0f2c9f1b6f..2bce3ebf6d 100644 --- a/test/generated/output/json.validateStringify/test_json_validateStringify_DynamicComposite.ts +++ b/test/generated/output/json.validateStringify/test_json_validateStringify_DynamicComposite.ts @@ -23,21 +23,27 @@ export const test_json_validateStringify_DynamicComposite = const value = input[key]; if (undefined === value) return true; if ( - RegExp( - /^[+-]?\d+(?:\.\d+)?(?:[eE][+-]?\d+)?$/, - ).test(key) + "number" === typeof Number(key) && + Number.isFinite(Number(key)) ) return ( "number" === typeof value && Number.isFinite(value) ); - if (RegExp(/^(prefix_(.*))/).test(key)) + if ( + "string" === typeof key && + RegExp(/^prefix_(.*)/).test(key) + ) return "string" === typeof value; - if (RegExp(/((.*)_postfix)$/).test(key)) + if ( + "string" === typeof key && + RegExp(/(.*)_postfix$/).test(key) + ) return "string" === typeof value; if ( + "string" === typeof key && RegExp( - /^(value_[+-]?\d+(?:\.\d+)?(?:[eE][+-]?\d+)?)$/, + /^value_[+-]?\d+(?:\.\d+)?(?:[eE][+-]?\d+)?$/, ).test(key) ) return ( @@ -47,8 +53,9 @@ export const test_json_validateStringify_DynamicComposite = "boolean" === typeof value ); if ( + "string" === typeof key && RegExp( - /^(between_(.*)_and_[+-]?\d+(?:\.\d+)?(?:[eE][+-]?\d+)?)$/, + /^between_(.*)_and_[+-]?\d+(?:\.\d+)?(?:[eE][+-]?\d+)?$/, ).test(key) ) return "boolean" === typeof value; @@ -102,9 +109,9 @@ export const test_json_validateStringify_DynamicComposite = if (undefined === value) return true; if ( - RegExp( - /^[+-]?\d+(?:\.\d+)?(?:[eE][+-]?\d+)?$/, - ).test(key) + "number" === + typeof Number(key) && + Number.isFinite(Number(key)) ) return ( ("number" === @@ -120,9 +127,8 @@ export const test_json_validateStringify_DynamicComposite = }) ); if ( - RegExp(/^(prefix_(.*))/).test( - key, - ) + "string" === typeof key && + RegExp(/^prefix_(.*)/).test(key) ) return ( "string" === typeof value || @@ -134,7 +140,8 @@ export const test_json_validateStringify_DynamicComposite = }) ); if ( - RegExp(/((.*)_postfix)$/).test( + "string" === typeof key && + RegExp(/(.*)_postfix$/).test( key, ) ) @@ -148,8 +155,9 @@ export const test_json_validateStringify_DynamicComposite = }) ); if ( + "string" === typeof key && RegExp( - /^(value_[+-]?\d+(?:\.\d+)?(?:[eE][+-]?\d+)?)$/, + /^value_[+-]?\d+(?:\.\d+)?(?:[eE][+-]?\d+)?$/, ).test(key) ) return ( @@ -170,8 +178,9 @@ export const test_json_validateStringify_DynamicComposite = }) ); if ( + "string" === typeof key && RegExp( - /^(between_(.*)_and_[+-]?\d+(?:\.\d+)?(?:[eE][+-]?\d+)?)$/, + /^between_(.*)_and_[+-]?\d+(?:\.\d+)?(?:[eE][+-]?\d+)?$/, ).test(key) ) return ( diff --git a/test/generated/output/json.validateStringify/test_json_validateStringify_DynamicNever.ts b/test/generated/output/json.validateStringify/test_json_validateStringify_DynamicNever.ts index 9d8cf2e952..086704c4f9 100644 --- a/test/generated/output/json.validateStringify/test_json_validateStringify_DynamicNever.ts +++ b/test/generated/output/json.validateStringify/test_json_validateStringify_DynamicNever.ts @@ -15,7 +15,7 @@ export const test_json_validateStringify_DynamicNever = Object.keys(input).every((key: any) => { const value = input[key]; if (undefined === value) return true; - if (RegExp(/(.*)/).test(key)) + if (true) return ( null !== value && undefined === value ); @@ -51,7 +51,7 @@ export const test_json_validateStringify_DynamicNever = const value = input[key]; if (undefined === value) return true; - if (RegExp(/(.*)/).test(key)) + if (true) return ( (null !== value || $report( diff --git a/test/generated/output/json.validateStringify/test_json_validateStringify_DynamicTemplate.ts b/test/generated/output/json.validateStringify/test_json_validateStringify_DynamicTemplate.ts index 44a308afec..931cea721c 100644 --- a/test/generated/output/json.validateStringify/test_json_validateStringify_DynamicTemplate.ts +++ b/test/generated/output/json.validateStringify/test_json_validateStringify_DynamicTemplate.ts @@ -16,13 +16,20 @@ export const test_json_validateStringify_DynamicTemplate = Object.keys(input).every((key: any) => { const value = input[key]; if (undefined === value) return true; - if (RegExp(/^(prefix_(.*))/).test(key)) + if ( + "string" === typeof key && + RegExp(/^prefix_(.*)/).test(key) + ) return "string" === typeof value; - if (RegExp(/((.*)_postfix)$/).test(key)) + if ( + "string" === typeof key && + RegExp(/(.*)_postfix$/).test(key) + ) return "string" === typeof value; if ( + "string" === typeof key && RegExp( - /^(value_[+-]?\d+(?:\.\d+)?(?:[eE][+-]?\d+)?)$/, + /^value_[+-]?\d+(?:\.\d+)?(?:[eE][+-]?\d+)?$/, ).test(key) ) return ( @@ -30,8 +37,9 @@ export const test_json_validateStringify_DynamicTemplate = Number.isFinite(value) ); if ( + "string" === typeof key && RegExp( - /^(between_(.*)_and_[+-]?\d+(?:\.\d+)?(?:[eE][+-]?\d+)?)$/, + /^between_(.*)_and_[+-]?\d+(?:\.\d+)?(?:[eE][+-]?\d+)?$/, ).test(key) ) return "boolean" === typeof value; @@ -68,9 +76,8 @@ export const test_json_validateStringify_DynamicTemplate = if (undefined === value) return true; if ( - RegExp(/^(prefix_(.*))/).test( - key, - ) + "string" === typeof key && + RegExp(/^prefix_(.*)/).test(key) ) return ( "string" === typeof value || @@ -82,7 +89,8 @@ export const test_json_validateStringify_DynamicTemplate = }) ); if ( - RegExp(/((.*)_postfix)$/).test( + "string" === typeof key && + RegExp(/(.*)_postfix$/).test( key, ) ) @@ -96,8 +104,9 @@ export const test_json_validateStringify_DynamicTemplate = }) ); if ( + "string" === typeof key && RegExp( - /^(value_[+-]?\d+(?:\.\d+)?(?:[eE][+-]?\d+)?)$/, + /^value_[+-]?\d+(?:\.\d+)?(?:[eE][+-]?\d+)?$/, ).test(key) ) return ( @@ -114,8 +123,9 @@ export const test_json_validateStringify_DynamicTemplate = }) ); if ( + "string" === typeof key && RegExp( - /^(between_(.*)_and_[+-]?\d+(?:\.\d+)?(?:[eE][+-]?\d+)?)$/, + /^between_(.*)_and_[+-]?\d+(?:\.\d+)?(?:[eE][+-]?\d+)?$/, ).test(key) ) return ( diff --git a/test/generated/output/json.validateStringify/test_json_validateStringify_DynamicTree.ts b/test/generated/output/json.validateStringify/test_json_validateStringify_DynamicTree.ts index ebf3bbe8f1..fd8ea48b34 100644 --- a/test/generated/output/json.validateStringify/test_json_validateStringify_DynamicTree.ts +++ b/test/generated/output/json.validateStringify/test_json_validateStringify_DynamicTree.ts @@ -23,7 +23,7 @@ export const test_json_validateStringify_DynamicTree = Object.keys(input).every((key: any) => { const value = input[key]; if (undefined === value) return true; - if (RegExp(/(.*)/).test(key)) + if (true) return ( "object" === typeof value && null !== value && @@ -101,7 +101,7 @@ export const test_json_validateStringify_DynamicTree = const value = input[key]; if (undefined === value) return true; - if (RegExp(/(.*)/).test(key)) + if (true) return ( ((("object" === typeof value && @@ -178,7 +178,7 @@ export const test_json_validateStringify_DynamicTree = Object.keys(input).every((key: any) => { const value = input[key]; if (undefined === value) return true; - if (RegExp(/(.*)/).test(key)) + if (true) return ( "object" === typeof value && null !== value && diff --git a/test/generated/output/json.validateStringify/test_json_validateStringify_DynamicUndefined.ts b/test/generated/output/json.validateStringify/test_json_validateStringify_DynamicUndefined.ts index 35d3d989ab..5c7e187545 100644 --- a/test/generated/output/json.validateStringify/test_json_validateStringify_DynamicUndefined.ts +++ b/test/generated/output/json.validateStringify/test_json_validateStringify_DynamicUndefined.ts @@ -16,7 +16,7 @@ export const test_json_validateStringify_DynamicUndefined = Object.keys(input).every((key: any) => { const value = input[key]; if (undefined === value) return true; - if (RegExp(/(.*)/).test(key)) + if (true) return null !== value && undefined === value; return true; }); @@ -50,7 +50,7 @@ export const test_json_validateStringify_DynamicUndefined = const value = input[key]; if (undefined === value) return true; - if (RegExp(/(.*)/).test(key)) + if (true) return ( (null !== value || $report( diff --git a/test/generated/output/json.validateStringify/test_json_validateStringify_DynamicUnion.ts b/test/generated/output/json.validateStringify/test_json_validateStringify_DynamicUnion.ts index 3cfa33bd7a..5fa58b6208 100644 --- a/test/generated/output/json.validateStringify/test_json_validateStringify_DynamicUnion.ts +++ b/test/generated/output/json.validateStringify/test_json_validateStringify_DynamicUnion.ts @@ -16,18 +16,24 @@ export const test_json_validateStringify_DynamicUnion = const value = input[key]; if (undefined === value) return true; if ( - RegExp( - /^[+-]?\d+(?:\.\d+)?(?:[eE][+-]?\d+)?$/, - ).test(key) + "number" === typeof Number(key) && + Number.isFinite(Number(key)) ) return "string" === typeof value; - if (RegExp(/^(prefix_(.*))/).test(key)) + if ( + "string" === typeof key && + RegExp(/^prefix_(.*)/).test(key) + ) return "string" === typeof value; - if (RegExp(/((.*)_postfix)$/).test(key)) + if ( + "string" === typeof key && + RegExp(/(.*)_postfix$/).test(key) + ) return "string" === typeof value; if ( + "string" === typeof key && RegExp( - /^(value_between_[+-]?\d+(?:\.\d+)?(?:[eE][+-]?\d+)?_and_[+-]?\d+(?:\.\d+)?(?:[eE][+-]?\d+)?)$/, + /^value_between_[+-]?\d+(?:\.\d+)?(?:[eE][+-]?\d+)?_and_[+-]?\d+(?:\.\d+)?(?:[eE][+-]?\d+)?$/, ).test(key) ) return ( @@ -67,9 +73,9 @@ export const test_json_validateStringify_DynamicUnion = if (undefined === value) return true; if ( - RegExp( - /^[+-]?\d+(?:\.\d+)?(?:[eE][+-]?\d+)?$/, - ).test(key) + "number" === + typeof Number(key) && + Number.isFinite(Number(key)) ) return ( "string" === @@ -87,9 +93,10 @@ export const test_json_validateStringify_DynamicUnion = ) ); if ( - RegExp( - /^(prefix_(.*))/, - ).test(key) + "string" === typeof key && + RegExp(/^prefix_(.*)/).test( + key, + ) ) return ( "string" === @@ -107,8 +114,9 @@ export const test_json_validateStringify_DynamicUnion = ) ); if ( + "string" === typeof key && RegExp( - /((.*)_postfix)$/, + /(.*)_postfix$/, ).test(key) ) return ( @@ -127,8 +135,9 @@ export const test_json_validateStringify_DynamicUnion = ) ); if ( + "string" === typeof key && RegExp( - /^(value_between_[+-]?\d+(?:\.\d+)?(?:[eE][+-]?\d+)?_and_[+-]?\d+(?:\.\d+)?(?:[eE][+-]?\d+)?)$/, + /^value_between_[+-]?\d+(?:\.\d+)?(?:[eE][+-]?\d+)?_and_[+-]?\d+(?:\.\d+)?(?:[eE][+-]?\d+)?$/, ).test(key) ) return ( diff --git a/test/generated/output/json.validateStringify/test_json_validateStringify_ObjectDynamic.ts b/test/generated/output/json.validateStringify/test_json_validateStringify_ObjectDynamic.ts index e9c8fa715f..b11b9503ca 100644 --- a/test/generated/output/json.validateStringify/test_json_validateStringify_ObjectDynamic.ts +++ b/test/generated/output/json.validateStringify/test_json_validateStringify_ObjectDynamic.ts @@ -15,7 +15,7 @@ export const test_json_validateStringify_ObjectDynamic = Object.keys(input).every((key: any) => { const value = input[key]; if (undefined === value) return true; - if (RegExp(/(.*)/).test(key)) + if (true) return ( "string" === typeof value || ("number" === typeof value && @@ -54,7 +54,7 @@ export const test_json_validateStringify_ObjectDynamic = const value = input[key]; if (undefined === value) return true; - if (RegExp(/(.*)/).test(key)) + if (true) return ( "string" === typeof value || diff --git a/test/generated/output/json.validateStringify/test_json_validateStringify_UltimateUnion.ts b/test/generated/output/json.validateStringify/test_json_validateStringify_UltimateUnion.ts index 49344e4d08..f6ffd4fb66 100644 --- a/test/generated/output/json.validateStringify/test_json_validateStringify_UltimateUnion.ts +++ b/test/generated/output/json.validateStringify/test_json_validateStringify_UltimateUnion.ts @@ -557,7 +557,7 @@ export const test_json_validateStringify_UltimateUnion = Object.keys(input).every((key: any) => { const value = input[key]; if (undefined === value) return true; - if (RegExp(/(.*)/).test(key)) + if (true) return ( "object" === typeof value && null !== value && @@ -641,7 +641,7 @@ export const test_json_validateStringify_UltimateUnion = Object.keys(input).every((key: any) => { const value = input[key]; if (undefined === value) return true; - if (RegExp(/(.*)/).test(key)) + if (true) return ( "object" === typeof value && null !== value && @@ -4165,7 +4165,7 @@ export const test_json_validateStringify_UltimateUnion = const value = input[key]; if (undefined === value) return true; - if (RegExp(/(.*)/).test(key)) + if (true) return ( ((("object" === typeof value && @@ -4529,7 +4529,7 @@ export const test_json_validateStringify_UltimateUnion = const value = input[key]; if (undefined === value) return true; - if (RegExp(/(.*)/).test(key)) + if (true) return ( ((("object" === typeof value && @@ -8087,7 +8087,7 @@ export const test_json_validateStringify_UltimateUnion = Object.keys(input).every((key: any) => { const value = input[key]; if (undefined === value) return true; - if (RegExp(/(.*)/).test(key)) + if (true) return ( "object" === typeof value && null !== value && @@ -8156,7 +8156,7 @@ export const test_json_validateStringify_UltimateUnion = Object.keys(input).every((key: any) => { const value = input[key]; if (undefined === value) return true; - if (RegExp(/(.*)/).test(key)) + if (true) return ( "object" === typeof value && null !== value && diff --git a/test/generated/output/misc.assertClone/test_misc_assertClone_DynamicComposite.ts b/test/generated/output/misc.assertClone/test_misc_assertClone_DynamicComposite.ts index 3a04476bdb..5e727ad20d 100644 --- a/test/generated/output/misc.assertClone/test_misc_assertClone_DynamicComposite.ts +++ b/test/generated/output/misc.assertClone/test_misc_assertClone_DynamicComposite.ts @@ -17,21 +17,27 @@ export const test_misc_assertClone_DynamicComposite = _test_misc_assertClone( const value = input[key]; if (undefined === value) return true; if ( - RegExp( - /^[+-]?\d+(?:\.\d+)?(?:[eE][+-]?\d+)?$/, - ).test(key) + "number" === typeof Number(key) && + Number.isFinite(Number(key)) ) return ( "number" === typeof value && Number.isFinite(value) ); - if (RegExp(/^(prefix_(.*))/).test(key)) + if ( + "string" === typeof key && + RegExp(/^prefix_(.*)/).test(key) + ) return "string" === typeof value; - if (RegExp(/((.*)_postfix)$/).test(key)) + if ( + "string" === typeof key && + RegExp(/(.*)_postfix$/).test(key) + ) return "string" === typeof value; if ( + "string" === typeof key && RegExp( - /^(value_[+-]?\d+(?:\.\d+)?(?:[eE][+-]?\d+)?)$/, + /^value_[+-]?\d+(?:\.\d+)?(?:[eE][+-]?\d+)?$/, ).test(key) ) return ( @@ -41,8 +47,9 @@ export const test_misc_assertClone_DynamicComposite = _test_misc_assertClone( "boolean" === typeof value ); if ( + "string" === typeof key && RegExp( - /^(between_(.*)_and_[+-]?\d+(?:\.\d+)?(?:[eE][+-]?\d+)?)$/, + /^between_(.*)_and_[+-]?\d+(?:\.\d+)?(?:[eE][+-]?\d+)?$/, ).test(key) ) return "boolean" === typeof value; @@ -88,9 +95,8 @@ export const test_misc_assertClone_DynamicComposite = _test_misc_assertClone( const value = input[key]; if (undefined === value) return true; if ( - RegExp( - /^[+-]?\d+(?:\.\d+)?(?:[eE][+-]?\d+)?$/, - ).test(key) + "number" === typeof Number(key) && + Number.isFinite(Number(key)) ) return ( ("number" === typeof value && @@ -101,7 +107,10 @@ export const test_misc_assertClone_DynamicComposite = _test_misc_assertClone( value: value, }) ); - if (RegExp(/^(prefix_(.*))/).test(key)) + if ( + "string" === typeof key && + RegExp(/^prefix_(.*)/).test(key) + ) return ( "string" === typeof value || $guard(_exceptionable, { @@ -110,7 +119,10 @@ export const test_misc_assertClone_DynamicComposite = _test_misc_assertClone( value: value, }) ); - if (RegExp(/((.*)_postfix)$/).test(key)) + if ( + "string" === typeof key && + RegExp(/(.*)_postfix$/).test(key) + ) return ( "string" === typeof value || $guard(_exceptionable, { @@ -120,8 +132,9 @@ export const test_misc_assertClone_DynamicComposite = _test_misc_assertClone( }) ); if ( + "string" === typeof key && RegExp( - /^(value_[+-]?\d+(?:\.\d+)?(?:[eE][+-]?\d+)?)$/, + /^value_[+-]?\d+(?:\.\d+)?(?:[eE][+-]?\d+)?$/, ).test(key) ) return ( @@ -137,8 +150,9 @@ export const test_misc_assertClone_DynamicComposite = _test_misc_assertClone( }) ); if ( + "string" === typeof key && RegExp( - /^(between_(.*)_and_[+-]?\d+(?:\.\d+)?(?:[eE][+-]?\d+)?)$/, + /^between_(.*)_and_[+-]?\d+(?:\.\d+)?(?:[eE][+-]?\d+)?$/, ).test(key) ) return ( diff --git a/test/generated/output/misc.assertClone/test_misc_assertClone_DynamicNever.ts b/test/generated/output/misc.assertClone/test_misc_assertClone_DynamicNever.ts index 86f610a93e..4ba0c88c0c 100644 --- a/test/generated/output/misc.assertClone/test_misc_assertClone_DynamicNever.ts +++ b/test/generated/output/misc.assertClone/test_misc_assertClone_DynamicNever.ts @@ -12,8 +12,7 @@ export const test_misc_assertClone_DynamicNever = _test_misc_assertClone( Object.keys(input).every((key: any) => { const value = input[key]; if (undefined === value) return true; - if (RegExp(/(.*)/).test(key)) - return null !== value && undefined === value; + if (true) return null !== value && undefined === value; return true; }); return ( @@ -40,7 +39,7 @@ export const test_misc_assertClone_DynamicNever = _test_misc_assertClone( Object.keys(input).every((key: any) => { const value = input[key]; if (undefined === value) return true; - if (RegExp(/(.*)/).test(key)) + if (true) return ( (null !== value || $guard(_exceptionable, { diff --git a/test/generated/output/misc.assertClone/test_misc_assertClone_DynamicTemplate.ts b/test/generated/output/misc.assertClone/test_misc_assertClone_DynamicTemplate.ts index 5d6da8b509..95f3f8d498 100644 --- a/test/generated/output/misc.assertClone/test_misc_assertClone_DynamicTemplate.ts +++ b/test/generated/output/misc.assertClone/test_misc_assertClone_DynamicTemplate.ts @@ -12,13 +12,20 @@ export const test_misc_assertClone_DynamicTemplate = _test_misc_assertClone( Object.keys(input).every((key: any) => { const value = input[key]; if (undefined === value) return true; - if (RegExp(/^(prefix_(.*))/).test(key)) + if ( + "string" === typeof key && + RegExp(/^prefix_(.*)/).test(key) + ) return "string" === typeof value; - if (RegExp(/((.*)_postfix)$/).test(key)) + if ( + "string" === typeof key && + RegExp(/(.*)_postfix$/).test(key) + ) return "string" === typeof value; if ( + "string" === typeof key && RegExp( - /^(value_[+-]?\d+(?:\.\d+)?(?:[eE][+-]?\d+)?)$/, + /^value_[+-]?\d+(?:\.\d+)?(?:[eE][+-]?\d+)?$/, ).test(key) ) return ( @@ -26,8 +33,9 @@ export const test_misc_assertClone_DynamicTemplate = _test_misc_assertClone( Number.isFinite(value) ); if ( + "string" === typeof key && RegExp( - /^(between_(.*)_and_[+-]?\d+(?:\.\d+)?(?:[eE][+-]?\d+)?)$/, + /^between_(.*)_and_[+-]?\d+(?:\.\d+)?(?:[eE][+-]?\d+)?$/, ).test(key) ) return "boolean" === typeof value; @@ -57,7 +65,10 @@ export const test_misc_assertClone_DynamicTemplate = _test_misc_assertClone( Object.keys(input).every((key: any) => { const value = input[key]; if (undefined === value) return true; - if (RegExp(/^(prefix_(.*))/).test(key)) + if ( + "string" === typeof key && + RegExp(/^prefix_(.*)/).test(key) + ) return ( "string" === typeof value || $guard(_exceptionable, { @@ -66,7 +77,10 @@ export const test_misc_assertClone_DynamicTemplate = _test_misc_assertClone( value: value, }) ); - if (RegExp(/((.*)_postfix)$/).test(key)) + if ( + "string" === typeof key && + RegExp(/(.*)_postfix$/).test(key) + ) return ( "string" === typeof value || $guard(_exceptionable, { @@ -76,8 +90,9 @@ export const test_misc_assertClone_DynamicTemplate = _test_misc_assertClone( }) ); if ( + "string" === typeof key && RegExp( - /^(value_[+-]?\d+(?:\.\d+)?(?:[eE][+-]?\d+)?)$/, + /^value_[+-]?\d+(?:\.\d+)?(?:[eE][+-]?\d+)?$/, ).test(key) ) return ( @@ -90,8 +105,9 @@ export const test_misc_assertClone_DynamicTemplate = _test_misc_assertClone( }) ); if ( + "string" === typeof key && RegExp( - /^(between_(.*)_and_[+-]?\d+(?:\.\d+)?(?:[eE][+-]?\d+)?)$/, + /^between_(.*)_and_[+-]?\d+(?:\.\d+)?(?:[eE][+-]?\d+)?$/, ).test(key) ) return ( diff --git a/test/generated/output/misc.assertClone/test_misc_assertClone_DynamicTree.ts b/test/generated/output/misc.assertClone/test_misc_assertClone_DynamicTree.ts index 158c4a8ec2..cac1082fea 100644 --- a/test/generated/output/misc.assertClone/test_misc_assertClone_DynamicTree.ts +++ b/test/generated/output/misc.assertClone/test_misc_assertClone_DynamicTree.ts @@ -20,7 +20,7 @@ export const test_misc_assertClone_DynamicTree = _test_misc_assertClone( Object.keys(input).every((key: any) => { const value = input[key]; if (undefined === value) return true; - if (RegExp(/(.*)/).test(key)) + if (true) return ( "object" === typeof value && null !== value && @@ -85,7 +85,7 @@ export const test_misc_assertClone_DynamicTree = _test_misc_assertClone( Object.keys(input).every((key: any) => { const value = input[key]; if (undefined === value) return true; - if (RegExp(/(.*)/).test(key)) + if (true) return ( ((("object" === typeof value && null !== value) || @@ -136,7 +136,7 @@ export const test_misc_assertClone_DynamicTree = _test_misc_assertClone( Object.keys(input).every((key: any) => { const value = input[key]; if (undefined === value) return true; - if (RegExp(/(.*)/).test(key)) + if (true) return ( "object" === typeof value && null !== value && diff --git a/test/generated/output/misc.assertClone/test_misc_assertClone_DynamicUndefined.ts b/test/generated/output/misc.assertClone/test_misc_assertClone_DynamicUndefined.ts index 0cfe7530db..4e7c233d37 100644 --- a/test/generated/output/misc.assertClone/test_misc_assertClone_DynamicUndefined.ts +++ b/test/generated/output/misc.assertClone/test_misc_assertClone_DynamicUndefined.ts @@ -12,8 +12,7 @@ export const test_misc_assertClone_DynamicUndefined = _test_misc_assertClone( Object.keys(input).every((key: any) => { const value = input[key]; if (undefined === value) return true; - if (RegExp(/(.*)/).test(key)) - return null !== value && undefined === value; + if (true) return null !== value && undefined === value; return true; }); return ( @@ -40,7 +39,7 @@ export const test_misc_assertClone_DynamicUndefined = _test_misc_assertClone( Object.keys(input).every((key: any) => { const value = input[key]; if (undefined === value) return true; - if (RegExp(/(.*)/).test(key)) + if (true) return ( (null !== value || $guard(_exceptionable, { diff --git a/test/generated/output/misc.assertClone/test_misc_assertClone_DynamicUnion.ts b/test/generated/output/misc.assertClone/test_misc_assertClone_DynamicUnion.ts index 4a773d4ca2..7d3c0a7517 100644 --- a/test/generated/output/misc.assertClone/test_misc_assertClone_DynamicUnion.ts +++ b/test/generated/output/misc.assertClone/test_misc_assertClone_DynamicUnion.ts @@ -13,18 +13,24 @@ export const test_misc_assertClone_DynamicUnion = _test_misc_assertClone( const value = input[key]; if (undefined === value) return true; if ( - RegExp( - /^[+-]?\d+(?:\.\d+)?(?:[eE][+-]?\d+)?$/, - ).test(key) + "number" === typeof Number(key) && + Number.isFinite(Number(key)) ) return "string" === typeof value; - if (RegExp(/^(prefix_(.*))/).test(key)) + if ( + "string" === typeof key && + RegExp(/^prefix_(.*)/).test(key) + ) return "string" === typeof value; - if (RegExp(/((.*)_postfix)$/).test(key)) + if ( + "string" === typeof key && + RegExp(/(.*)_postfix$/).test(key) + ) return "string" === typeof value; if ( + "string" === typeof key && RegExp( - /^(value_between_[+-]?\d+(?:\.\d+)?(?:[eE][+-]?\d+)?_and_[+-]?\d+(?:\.\d+)?(?:[eE][+-]?\d+)?)$/, + /^value_between_[+-]?\d+(?:\.\d+)?(?:[eE][+-]?\d+)?_and_[+-]?\d+(?:\.\d+)?(?:[eE][+-]?\d+)?$/, ).test(key) ) return ( @@ -58,9 +64,8 @@ export const test_misc_assertClone_DynamicUnion = _test_misc_assertClone( const value = input[key]; if (undefined === value) return true; if ( - RegExp( - /^[+-]?\d+(?:\.\d+)?(?:[eE][+-]?\d+)?$/, - ).test(key) + "number" === typeof Number(key) && + Number.isFinite(Number(key)) ) return ( "string" === typeof value || @@ -70,7 +75,10 @@ export const test_misc_assertClone_DynamicUnion = _test_misc_assertClone( value: value, }) ); - if (RegExp(/^(prefix_(.*))/).test(key)) + if ( + "string" === typeof key && + RegExp(/^prefix_(.*)/).test(key) + ) return ( "string" === typeof value || $guard(_exceptionable, { @@ -79,7 +87,10 @@ export const test_misc_assertClone_DynamicUnion = _test_misc_assertClone( value: value, }) ); - if (RegExp(/((.*)_postfix)$/).test(key)) + if ( + "string" === typeof key && + RegExp(/(.*)_postfix$/).test(key) + ) return ( "string" === typeof value || $guard(_exceptionable, { @@ -89,8 +100,9 @@ export const test_misc_assertClone_DynamicUnion = _test_misc_assertClone( }) ); if ( + "string" === typeof key && RegExp( - /^(value_between_[+-]?\d+(?:\.\d+)?(?:[eE][+-]?\d+)?_and_[+-]?\d+(?:\.\d+)?(?:[eE][+-]?\d+)?)$/, + /^value_between_[+-]?\d+(?:\.\d+)?(?:[eE][+-]?\d+)?_and_[+-]?\d+(?:\.\d+)?(?:[eE][+-]?\d+)?$/, ).test(key) ) return ( diff --git a/test/generated/output/misc.assertClone/test_misc_assertClone_ObjectDynamic.ts b/test/generated/output/misc.assertClone/test_misc_assertClone_ObjectDynamic.ts index 3f9c61f799..f4678bac01 100644 --- a/test/generated/output/misc.assertClone/test_misc_assertClone_ObjectDynamic.ts +++ b/test/generated/output/misc.assertClone/test_misc_assertClone_ObjectDynamic.ts @@ -12,7 +12,7 @@ export const test_misc_assertClone_ObjectDynamic = _test_misc_assertClone( Object.keys(input).every((key: any) => { const value = input[key]; if (undefined === value) return true; - if (RegExp(/(.*)/).test(key)) + if (true) return ( "string" === typeof value || ("number" === typeof value && @@ -45,7 +45,7 @@ export const test_misc_assertClone_ObjectDynamic = _test_misc_assertClone( Object.keys(input).every((key: any) => { const value = input[key]; if (undefined === value) return true; - if (RegExp(/(.*)/).test(key)) + if (true) return ( "string" === typeof value || ("number" === typeof value && diff --git a/test/generated/output/misc.assertClone/test_misc_assertClone_UltimateUnion.ts b/test/generated/output/misc.assertClone/test_misc_assertClone_UltimateUnion.ts index 7ad483d30b..9d29e95b43 100644 --- a/test/generated/output/misc.assertClone/test_misc_assertClone_UltimateUnion.ts +++ b/test/generated/output/misc.assertClone/test_misc_assertClone_UltimateUnion.ts @@ -518,7 +518,7 @@ export const test_misc_assertClone_UltimateUnion = _test_misc_assertClone( Object.keys(input).every((key: any) => { const value = input[key]; if (undefined === value) return true; - if (RegExp(/(.*)/).test(key)) + if (true) return ( "object" === typeof value && null !== value && @@ -585,7 +585,7 @@ export const test_misc_assertClone_UltimateUnion = _test_misc_assertClone( Object.keys(input).every((key: any) => { const value = input[key]; if (undefined === value) return true; - if (RegExp(/(.*)/).test(key)) + if (true) return ( "object" === typeof value && null !== value && @@ -3393,7 +3393,7 @@ export const test_misc_assertClone_UltimateUnion = _test_misc_assertClone( Object.keys(input).every((key: any) => { const value = input[key]; if (undefined === value) return true; - if (RegExp(/(.*)/).test(key)) + if (true) return ( ((("object" === typeof value && null !== value && @@ -3649,7 +3649,7 @@ export const test_misc_assertClone_UltimateUnion = _test_misc_assertClone( Object.keys(input).every((key: any) => { const value = input[key]; if (undefined === value) return true; - if (RegExp(/(.*)/).test(key)) + if (true) return ( ((("object" === typeof value && null !== value && @@ -6560,7 +6560,7 @@ export const test_misc_assertClone_UltimateUnion = _test_misc_assertClone( Object.keys(input).every((key: any) => { const value = input[key]; if (undefined === value) return true; - if (RegExp(/(.*)/).test(key)) + if (true) return ( "object" === typeof value && null !== value && @@ -6622,7 +6622,7 @@ export const test_misc_assertClone_UltimateUnion = _test_misc_assertClone( Object.keys(input).every((key: any) => { const value = input[key]; if (undefined === value) return true; - if (RegExp(/(.*)/).test(key)) + if (true) return ( "object" === typeof value && null !== value && diff --git a/test/generated/output/misc.assertPrune/test_misc_assertPrune_DynamicComposite.ts b/test/generated/output/misc.assertPrune/test_misc_assertPrune_DynamicComposite.ts index f16a13922f..11d11de439 100644 --- a/test/generated/output/misc.assertPrune/test_misc_assertPrune_DynamicComposite.ts +++ b/test/generated/output/misc.assertPrune/test_misc_assertPrune_DynamicComposite.ts @@ -17,21 +17,27 @@ export const test_misc_assertPrune_DynamicComposite = _test_misc_assertPrune( const value = input[key]; if (undefined === value) return true; if ( - RegExp( - /^[+-]?\d+(?:\.\d+)?(?:[eE][+-]?\d+)?$/, - ).test(key) + "number" === typeof Number(key) && + Number.isFinite(Number(key)) ) return ( "number" === typeof value && Number.isFinite(value) ); - if (RegExp(/^(prefix_(.*))/).test(key)) + if ( + "string" === typeof key && + RegExp(/^prefix_(.*)/).test(key) + ) return "string" === typeof value; - if (RegExp(/((.*)_postfix)$/).test(key)) + if ( + "string" === typeof key && + RegExp(/(.*)_postfix$/).test(key) + ) return "string" === typeof value; if ( + "string" === typeof key && RegExp( - /^(value_[+-]?\d+(?:\.\d+)?(?:[eE][+-]?\d+)?)$/, + /^value_[+-]?\d+(?:\.\d+)?(?:[eE][+-]?\d+)?$/, ).test(key) ) return ( @@ -41,8 +47,9 @@ export const test_misc_assertPrune_DynamicComposite = _test_misc_assertPrune( "boolean" === typeof value ); if ( + "string" === typeof key && RegExp( - /^(between_(.*)_and_[+-]?\d+(?:\.\d+)?(?:[eE][+-]?\d+)?)$/, + /^between_(.*)_and_[+-]?\d+(?:\.\d+)?(?:[eE][+-]?\d+)?$/, ).test(key) ) return "boolean" === typeof value; @@ -88,9 +95,8 @@ export const test_misc_assertPrune_DynamicComposite = _test_misc_assertPrune( const value = input[key]; if (undefined === value) return true; if ( - RegExp( - /^[+-]?\d+(?:\.\d+)?(?:[eE][+-]?\d+)?$/, - ).test(key) + "number" === typeof Number(key) && + Number.isFinite(Number(key)) ) return ( ("number" === typeof value && @@ -101,7 +107,10 @@ export const test_misc_assertPrune_DynamicComposite = _test_misc_assertPrune( value: value, }) ); - if (RegExp(/^(prefix_(.*))/).test(key)) + if ( + "string" === typeof key && + RegExp(/^prefix_(.*)/).test(key) + ) return ( "string" === typeof value || $guard(_exceptionable, { @@ -110,7 +119,10 @@ export const test_misc_assertPrune_DynamicComposite = _test_misc_assertPrune( value: value, }) ); - if (RegExp(/((.*)_postfix)$/).test(key)) + if ( + "string" === typeof key && + RegExp(/(.*)_postfix$/).test(key) + ) return ( "string" === typeof value || $guard(_exceptionable, { @@ -120,8 +132,9 @@ export const test_misc_assertPrune_DynamicComposite = _test_misc_assertPrune( }) ); if ( + "string" === typeof key && RegExp( - /^(value_[+-]?\d+(?:\.\d+)?(?:[eE][+-]?\d+)?)$/, + /^value_[+-]?\d+(?:\.\d+)?(?:[eE][+-]?\d+)?$/, ).test(key) ) return ( @@ -137,8 +150,9 @@ export const test_misc_assertPrune_DynamicComposite = _test_misc_assertPrune( }) ); if ( + "string" === typeof key && RegExp( - /^(between_(.*)_and_[+-]?\d+(?:\.\d+)?(?:[eE][+-]?\d+)?)$/, + /^between_(.*)_and_[+-]?\d+(?:\.\d+)?(?:[eE][+-]?\d+)?$/, ).test(key) ) return ( diff --git a/test/generated/output/misc.assertPrune/test_misc_assertPrune_DynamicTag.ts b/test/generated/output/misc.assertPrune/test_misc_assertPrune_DynamicTag.ts new file mode 100644 index 0000000000..b1b239164a --- /dev/null +++ b/test/generated/output/misc.assertPrune/test_misc_assertPrune_DynamicTag.ts @@ -0,0 +1,155 @@ +import typia from "../../../../src"; +import { _test_misc_assertPrune } from "../../../internal/_test_misc_assertPrune"; +import { DynamicTag } from "../../../structures/DynamicTag"; + +export const test_misc_assertPrune_DynamicTag = _test_misc_assertPrune( + "DynamicTag", +)(DynamicTag)((input) => + ((input: any): DynamicTag => { + const assert = (input: any): DynamicTag => { + const __is = (input: any): input is DynamicTag => { + const $io0 = (input: any): boolean => + Object.keys(input).every((key: any) => { + const value = input[key]; + if (undefined === value) return true; + if ( + "number" === typeof Number(key) && + 0 <= Number(key) && + Number(key) < 10 + ) + return ( + "bigint" === typeof value && BigInt(0) <= value + ); + if ( + "string" === typeof key && + /^(?:[0-9a-f]{8}-[0-9a-f]{4}-[1-5][0-9a-f]{3}-[89ab][0-9a-f]{3}-[0-9a-f]{12}|00000000-0000-0000-0000-000000000000)$/i.test( + key, + ) + ) + return ( + "string" === typeof value && + /^(([^<>()[\]\.,;:\s@\"]+(\.[^<>()[\]\.,;:\s@\"]+)*)|(\".+\"))@(([^<>()[\]\.,;:\s@\"]+\.)+[^<>()[\]\.,;:\s@\"]{2,})$/i.test( + value, + ) + ); + return true; + }); + return ( + "object" === typeof input && + null !== input && + false === Array.isArray(input) && + $io0(input) + ); + }; + if (false === __is(input)) + (( + input: any, + _path: string, + _exceptionable: boolean = true, + ): input is DynamicTag => { + const $guard = (typia.misc.assertPrune as any).guard; + const $join = (typia.misc.assertPrune as any).join; + const $ao0 = ( + input: any, + _path: string, + _exceptionable: boolean = true, + ): boolean => + false === _exceptionable || + Object.keys(input).every((key: any) => { + const value = input[key]; + if (undefined === value) return true; + if ( + "number" === typeof Number(key) && + 0 <= Number(key) && + Number(key) < 10 + ) + return ( + ("bigint" === typeof value && + (BigInt(0) <= value || + $guard(_exceptionable, { + path: _path + $join(key), + expected: + 'bigint & Type<"uint64">', + value: value, + }))) || + $guard(_exceptionable, { + path: _path + $join(key), + expected: '(bigint & Type<"uint64">)', + value: value, + }) + ); + if ( + "string" === typeof key && + /^(?:[0-9a-f]{8}-[0-9a-f]{4}-[1-5][0-9a-f]{3}-[89ab][0-9a-f]{3}-[0-9a-f]{12}|00000000-0000-0000-0000-000000000000)$/i.test( + key, + ) + ) + return ( + ("string" === typeof value && + (/^(([^<>()[\]\.,;:\s@\"]+(\.[^<>()[\]\.,;:\s@\"]+)*)|(\".+\"))@(([^<>()[\]\.,;:\s@\"]+\.)+[^<>()[\]\.,;:\s@\"]{2,})$/i.test( + value, + ) || + $guard(_exceptionable, { + path: _path + $join(key), + expected: + 'string & Format<"email">', + value: value, + }))) || + $guard(_exceptionable, { + path: _path + $join(key), + expected: '(string & Format<"email">)', + value: value, + }) + ); + return true; + }); + return ( + ((("object" === typeof input && + null !== input && + false === Array.isArray(input)) || + $guard(true, { + path: _path + "", + expected: "DynamicTag", + value: input, + })) && + $ao0(input, _path + "", true)) || + $guard(true, { + path: _path + "", + expected: "DynamicTag", + value: input, + }) + ); + })(input, "$input", true); + return input; + }; + const prune = (input: DynamicTag): void => { + const $po0 = (input: any): any => { + Object.entries(input).forEach(([key, value]: any) => { + if (undefined === value) return; + if ( + RegExp(/^[+-]?\d+(?:\.\d+)?(?:[eE][+-]?\d+)?$/).test( + key, + ) + ) { + } + if (RegExp(/(.*)/).test(key)) { + } + }); + for (const key of Object.keys(input)) { + if ( + RegExp(/^[+-]?\d+(?:\.\d+)?(?:[eE][+-]?\d+)?$/).test( + key, + ) || + RegExp(/(.*)/).test(key) + ) + continue; + delete input[key]; + } + }; + if ("object" === typeof input && null !== input) $po0(input); + }; + assert(input); + prune(input); + return input; + })(input), +); diff --git a/test/generated/output/misc.assertPrune/test_misc_assertPrune_DynamicTemplate.ts b/test/generated/output/misc.assertPrune/test_misc_assertPrune_DynamicTemplate.ts index a4addf3473..b82ddeec1e 100644 --- a/test/generated/output/misc.assertPrune/test_misc_assertPrune_DynamicTemplate.ts +++ b/test/generated/output/misc.assertPrune/test_misc_assertPrune_DynamicTemplate.ts @@ -12,13 +12,20 @@ export const test_misc_assertPrune_DynamicTemplate = _test_misc_assertPrune( Object.keys(input).every((key: any) => { const value = input[key]; if (undefined === value) return true; - if (RegExp(/^(prefix_(.*))/).test(key)) + if ( + "string" === typeof key && + RegExp(/^prefix_(.*)/).test(key) + ) return "string" === typeof value; - if (RegExp(/((.*)_postfix)$/).test(key)) + if ( + "string" === typeof key && + RegExp(/(.*)_postfix$/).test(key) + ) return "string" === typeof value; if ( + "string" === typeof key && RegExp( - /^(value_[+-]?\d+(?:\.\d+)?(?:[eE][+-]?\d+)?)$/, + /^value_[+-]?\d+(?:\.\d+)?(?:[eE][+-]?\d+)?$/, ).test(key) ) return ( @@ -26,8 +33,9 @@ export const test_misc_assertPrune_DynamicTemplate = _test_misc_assertPrune( Number.isFinite(value) ); if ( + "string" === typeof key && RegExp( - /^(between_(.*)_and_[+-]?\d+(?:\.\d+)?(?:[eE][+-]?\d+)?)$/, + /^between_(.*)_and_[+-]?\d+(?:\.\d+)?(?:[eE][+-]?\d+)?$/, ).test(key) ) return "boolean" === typeof value; @@ -57,7 +65,10 @@ export const test_misc_assertPrune_DynamicTemplate = _test_misc_assertPrune( Object.keys(input).every((key: any) => { const value = input[key]; if (undefined === value) return true; - if (RegExp(/^(prefix_(.*))/).test(key)) + if ( + "string" === typeof key && + RegExp(/^prefix_(.*)/).test(key) + ) return ( "string" === typeof value || $guard(_exceptionable, { @@ -66,7 +77,10 @@ export const test_misc_assertPrune_DynamicTemplate = _test_misc_assertPrune( value: value, }) ); - if (RegExp(/((.*)_postfix)$/).test(key)) + if ( + "string" === typeof key && + RegExp(/(.*)_postfix$/).test(key) + ) return ( "string" === typeof value || $guard(_exceptionable, { @@ -76,8 +90,9 @@ export const test_misc_assertPrune_DynamicTemplate = _test_misc_assertPrune( }) ); if ( + "string" === typeof key && RegExp( - /^(value_[+-]?\d+(?:\.\d+)?(?:[eE][+-]?\d+)?)$/, + /^value_[+-]?\d+(?:\.\d+)?(?:[eE][+-]?\d+)?$/, ).test(key) ) return ( @@ -90,8 +105,9 @@ export const test_misc_assertPrune_DynamicTemplate = _test_misc_assertPrune( }) ); if ( + "string" === typeof key && RegExp( - /^(between_(.*)_and_[+-]?\d+(?:\.\d+)?(?:[eE][+-]?\d+)?)$/, + /^between_(.*)_and_[+-]?\d+(?:\.\d+)?(?:[eE][+-]?\d+)?$/, ).test(key) ) return ( diff --git a/test/generated/output/misc.assertPrune/test_misc_assertPrune_DynamicUnion.ts b/test/generated/output/misc.assertPrune/test_misc_assertPrune_DynamicUnion.ts index 5cec6a115d..8187008e87 100644 --- a/test/generated/output/misc.assertPrune/test_misc_assertPrune_DynamicUnion.ts +++ b/test/generated/output/misc.assertPrune/test_misc_assertPrune_DynamicUnion.ts @@ -13,18 +13,24 @@ export const test_misc_assertPrune_DynamicUnion = _test_misc_assertPrune( const value = input[key]; if (undefined === value) return true; if ( - RegExp( - /^[+-]?\d+(?:\.\d+)?(?:[eE][+-]?\d+)?$/, - ).test(key) + "number" === typeof Number(key) && + Number.isFinite(Number(key)) ) return "string" === typeof value; - if (RegExp(/^(prefix_(.*))/).test(key)) + if ( + "string" === typeof key && + RegExp(/^prefix_(.*)/).test(key) + ) return "string" === typeof value; - if (RegExp(/((.*)_postfix)$/).test(key)) + if ( + "string" === typeof key && + RegExp(/(.*)_postfix$/).test(key) + ) return "string" === typeof value; if ( + "string" === typeof key && RegExp( - /^(value_between_[+-]?\d+(?:\.\d+)?(?:[eE][+-]?\d+)?_and_[+-]?\d+(?:\.\d+)?(?:[eE][+-]?\d+)?)$/, + /^value_between_[+-]?\d+(?:\.\d+)?(?:[eE][+-]?\d+)?_and_[+-]?\d+(?:\.\d+)?(?:[eE][+-]?\d+)?$/, ).test(key) ) return ( @@ -58,9 +64,8 @@ export const test_misc_assertPrune_DynamicUnion = _test_misc_assertPrune( const value = input[key]; if (undefined === value) return true; if ( - RegExp( - /^[+-]?\d+(?:\.\d+)?(?:[eE][+-]?\d+)?$/, - ).test(key) + "number" === typeof Number(key) && + Number.isFinite(Number(key)) ) return ( "string" === typeof value || @@ -70,7 +75,10 @@ export const test_misc_assertPrune_DynamicUnion = _test_misc_assertPrune( value: value, }) ); - if (RegExp(/^(prefix_(.*))/).test(key)) + if ( + "string" === typeof key && + RegExp(/^prefix_(.*)/).test(key) + ) return ( "string" === typeof value || $guard(_exceptionable, { @@ -79,7 +87,10 @@ export const test_misc_assertPrune_DynamicUnion = _test_misc_assertPrune( value: value, }) ); - if (RegExp(/((.*)_postfix)$/).test(key)) + if ( + "string" === typeof key && + RegExp(/(.*)_postfix$/).test(key) + ) return ( "string" === typeof value || $guard(_exceptionable, { @@ -89,8 +100,9 @@ export const test_misc_assertPrune_DynamicUnion = _test_misc_assertPrune( }) ); if ( + "string" === typeof key && RegExp( - /^(value_between_[+-]?\d+(?:\.\d+)?(?:[eE][+-]?\d+)?_and_[+-]?\d+(?:\.\d+)?(?:[eE][+-]?\d+)?)$/, + /^value_between_[+-]?\d+(?:\.\d+)?(?:[eE][+-]?\d+)?_and_[+-]?\d+(?:\.\d+)?(?:[eE][+-]?\d+)?$/, ).test(key) ) return ( diff --git a/test/generated/output/misc.clone/test_misc_clone_DynamicArray.ts b/test/generated/output/misc.clone/test_misc_clone_DynamicArray.ts index bc24221a3b..d933588542 100644 --- a/test/generated/output/misc.clone/test_misc_clone_DynamicArray.ts +++ b/test/generated/output/misc.clone/test_misc_clone_DynamicArray.ts @@ -10,7 +10,7 @@ export const test_misc_clone_DynamicArray = _test_misc_clone( Object.keys(input).every((key: any) => { const value = input[key]; if (undefined === value) return true; - if (RegExp(/(.*)/).test(key)) + if (true) return ( Array.isArray(value) && value.every((elem: any) => "string" === typeof elem) diff --git a/test/generated/output/misc.clone/test_misc_clone_DynamicSimple.ts b/test/generated/output/misc.clone/test_misc_clone_DynamicSimple.ts index 9bb489f0ac..0b87e5a4d5 100644 --- a/test/generated/output/misc.clone/test_misc_clone_DynamicSimple.ts +++ b/test/generated/output/misc.clone/test_misc_clone_DynamicSimple.ts @@ -10,7 +10,7 @@ export const test_misc_clone_DynamicSimple = _test_misc_clone( Object.keys(input).every((key: any) => { const value = input[key]; if (undefined === value) return true; - if (RegExp(/(.*)/).test(key)) return "number" === typeof value; + if (true) return "number" === typeof value; return true; }); const $co0 = (input: any): any => ({ diff --git a/test/generated/output/misc.clone/test_misc_clone_DynamicTree.ts b/test/generated/output/misc.clone/test_misc_clone_DynamicTree.ts index e0b4910fb6..1def068c6e 100644 --- a/test/generated/output/misc.clone/test_misc_clone_DynamicTree.ts +++ b/test/generated/output/misc.clone/test_misc_clone_DynamicTree.ts @@ -17,7 +17,7 @@ export const test_misc_clone_DynamicTree = _test_misc_clone( Object.keys(input).every((key: any) => { const value = input[key]; if (undefined === value) return true; - if (RegExp(/(.*)/).test(key)) + if (true) return ( "object" === typeof value && null !== value && diff --git a/test/generated/output/misc.clone/test_misc_clone_UltimateUnion.ts b/test/generated/output/misc.clone/test_misc_clone_UltimateUnion.ts index 8ed8169d1f..95b77f6a47 100644 --- a/test/generated/output/misc.clone/test_misc_clone_UltimateUnion.ts +++ b/test/generated/output/misc.clone/test_misc_clone_UltimateUnion.ts @@ -474,7 +474,7 @@ export const test_misc_clone_UltimateUnion = _test_misc_clone( Object.keys(input).every((key: any) => { const value = input[key]; if (undefined === value) return true; - if (RegExp(/(.*)/).test(key)) + if (true) return ( "object" === typeof value && null !== value && @@ -533,7 +533,7 @@ export const test_misc_clone_UltimateUnion = _test_misc_clone( Object.keys(input).every((key: any) => { const value = input[key]; if (undefined === value) return true; - if (RegExp(/(.*)/).test(key)) + if (true) return ( "object" === typeof value && null !== value && diff --git a/test/generated/output/misc.createAssertClone/test_misc_createAssertClone_DynamicComposite.ts b/test/generated/output/misc.createAssertClone/test_misc_createAssertClone_DynamicComposite.ts index 26645a6992..521a7bdd17 100644 --- a/test/generated/output/misc.createAssertClone/test_misc_createAssertClone_DynamicComposite.ts +++ b/test/generated/output/misc.createAssertClone/test_misc_createAssertClone_DynamicComposite.ts @@ -17,21 +17,27 @@ export const test_misc_createAssertClone_DynamicComposite = const value = input[key]; if (undefined === value) return true; if ( - RegExp( - /^[+-]?\d+(?:\.\d+)?(?:[eE][+-]?\d+)?$/, - ).test(key) + "number" === typeof Number(key) && + Number.isFinite(Number(key)) ) return ( "number" === typeof value && Number.isFinite(value) ); - if (RegExp(/^(prefix_(.*))/).test(key)) + if ( + "string" === typeof key && + RegExp(/^prefix_(.*)/).test(key) + ) return "string" === typeof value; - if (RegExp(/((.*)_postfix)$/).test(key)) + if ( + "string" === typeof key && + RegExp(/(.*)_postfix$/).test(key) + ) return "string" === typeof value; if ( + "string" === typeof key && RegExp( - /^(value_[+-]?\d+(?:\.\d+)?(?:[eE][+-]?\d+)?)$/, + /^value_[+-]?\d+(?:\.\d+)?(?:[eE][+-]?\d+)?$/, ).test(key) ) return ( @@ -41,8 +47,9 @@ export const test_misc_createAssertClone_DynamicComposite = "boolean" === typeof value ); if ( + "string" === typeof key && RegExp( - /^(between_(.*)_and_[+-]?\d+(?:\.\d+)?(?:[eE][+-]?\d+)?)$/, + /^between_(.*)_and_[+-]?\d+(?:\.\d+)?(?:[eE][+-]?\d+)?$/, ).test(key) ) return "boolean" === typeof value; @@ -88,9 +95,8 @@ export const test_misc_createAssertClone_DynamicComposite = const value = input[key]; if (undefined === value) return true; if ( - RegExp( - /^[+-]?\d+(?:\.\d+)?(?:[eE][+-]?\d+)?$/, - ).test(key) + "number" === typeof Number(key) && + Number.isFinite(Number(key)) ) return ( ("number" === typeof value && @@ -101,7 +107,10 @@ export const test_misc_createAssertClone_DynamicComposite = value: value, }) ); - if (RegExp(/^(prefix_(.*))/).test(key)) + if ( + "string" === typeof key && + RegExp(/^prefix_(.*)/).test(key) + ) return ( "string" === typeof value || $guard(_exceptionable, { @@ -110,7 +119,10 @@ export const test_misc_createAssertClone_DynamicComposite = value: value, }) ); - if (RegExp(/((.*)_postfix)$/).test(key)) + if ( + "string" === typeof key && + RegExp(/(.*)_postfix$/).test(key) + ) return ( "string" === typeof value || $guard(_exceptionable, { @@ -120,8 +132,9 @@ export const test_misc_createAssertClone_DynamicComposite = }) ); if ( + "string" === typeof key && RegExp( - /^(value_[+-]?\d+(?:\.\d+)?(?:[eE][+-]?\d+)?)$/, + /^value_[+-]?\d+(?:\.\d+)?(?:[eE][+-]?\d+)?$/, ).test(key) ) return ( @@ -137,8 +150,9 @@ export const test_misc_createAssertClone_DynamicComposite = }) ); if ( + "string" === typeof key && RegExp( - /^(between_(.*)_and_[+-]?\d+(?:\.\d+)?(?:[eE][+-]?\d+)?)$/, + /^between_(.*)_and_[+-]?\d+(?:\.\d+)?(?:[eE][+-]?\d+)?$/, ).test(key) ) return ( diff --git a/test/generated/output/misc.createAssertClone/test_misc_createAssertClone_DynamicNever.ts b/test/generated/output/misc.createAssertClone/test_misc_createAssertClone_DynamicNever.ts index fd8ac1b1e7..89db7c6e50 100644 --- a/test/generated/output/misc.createAssertClone/test_misc_createAssertClone_DynamicNever.ts +++ b/test/generated/output/misc.createAssertClone/test_misc_createAssertClone_DynamicNever.ts @@ -11,8 +11,7 @@ export const test_misc_createAssertClone_DynamicNever = _test_misc_assertClone( Object.keys(input).every((key: any) => { const value = input[key]; if (undefined === value) return true; - if (RegExp(/(.*)/).test(key)) - return null !== value && undefined === value; + if (true) return null !== value && undefined === value; return true; }); return ( @@ -39,7 +38,7 @@ export const test_misc_createAssertClone_DynamicNever = _test_misc_assertClone( Object.keys(input).every((key: any) => { const value = input[key]; if (undefined === value) return true; - if (RegExp(/(.*)/).test(key)) + if (true) return ( (null !== value || $guard(_exceptionable, { diff --git a/test/generated/output/misc.createAssertClone/test_misc_createAssertClone_DynamicTemplate.ts b/test/generated/output/misc.createAssertClone/test_misc_createAssertClone_DynamicTemplate.ts index 72436e1f76..c546627f7c 100644 --- a/test/generated/output/misc.createAssertClone/test_misc_createAssertClone_DynamicTemplate.ts +++ b/test/generated/output/misc.createAssertClone/test_misc_createAssertClone_DynamicTemplate.ts @@ -11,13 +11,20 @@ export const test_misc_createAssertClone_DynamicTemplate = Object.keys(input).every((key: any) => { const value = input[key]; if (undefined === value) return true; - if (RegExp(/^(prefix_(.*))/).test(key)) + if ( + "string" === typeof key && + RegExp(/^prefix_(.*)/).test(key) + ) return "string" === typeof value; - if (RegExp(/((.*)_postfix)$/).test(key)) + if ( + "string" === typeof key && + RegExp(/(.*)_postfix$/).test(key) + ) return "string" === typeof value; if ( + "string" === typeof key && RegExp( - /^(value_[+-]?\d+(?:\.\d+)?(?:[eE][+-]?\d+)?)$/, + /^value_[+-]?\d+(?:\.\d+)?(?:[eE][+-]?\d+)?$/, ).test(key) ) return ( @@ -25,8 +32,9 @@ export const test_misc_createAssertClone_DynamicTemplate = Number.isFinite(value) ); if ( + "string" === typeof key && RegExp( - /^(between_(.*)_and_[+-]?\d+(?:\.\d+)?(?:[eE][+-]?\d+)?)$/, + /^between_(.*)_and_[+-]?\d+(?:\.\d+)?(?:[eE][+-]?\d+)?$/, ).test(key) ) return "boolean" === typeof value; @@ -58,7 +66,10 @@ export const test_misc_createAssertClone_DynamicTemplate = Object.keys(input).every((key: any) => { const value = input[key]; if (undefined === value) return true; - if (RegExp(/^(prefix_(.*))/).test(key)) + if ( + "string" === typeof key && + RegExp(/^prefix_(.*)/).test(key) + ) return ( "string" === typeof value || $guard(_exceptionable, { @@ -67,7 +78,10 @@ export const test_misc_createAssertClone_DynamicTemplate = value: value, }) ); - if (RegExp(/((.*)_postfix)$/).test(key)) + if ( + "string" === typeof key && + RegExp(/(.*)_postfix$/).test(key) + ) return ( "string" === typeof value || $guard(_exceptionable, { @@ -77,8 +91,9 @@ export const test_misc_createAssertClone_DynamicTemplate = }) ); if ( + "string" === typeof key && RegExp( - /^(value_[+-]?\d+(?:\.\d+)?(?:[eE][+-]?\d+)?)$/, + /^value_[+-]?\d+(?:\.\d+)?(?:[eE][+-]?\d+)?$/, ).test(key) ) return ( @@ -91,8 +106,9 @@ export const test_misc_createAssertClone_DynamicTemplate = }) ); if ( + "string" === typeof key && RegExp( - /^(between_(.*)_and_[+-]?\d+(?:\.\d+)?(?:[eE][+-]?\d+)?)$/, + /^between_(.*)_and_[+-]?\d+(?:\.\d+)?(?:[eE][+-]?\d+)?$/, ).test(key) ) return ( diff --git a/test/generated/output/misc.createAssertClone/test_misc_createAssertClone_DynamicTree.ts b/test/generated/output/misc.createAssertClone/test_misc_createAssertClone_DynamicTree.ts index 76179ae535..35f7bbb96d 100644 --- a/test/generated/output/misc.createAssertClone/test_misc_createAssertClone_DynamicTree.ts +++ b/test/generated/output/misc.createAssertClone/test_misc_createAssertClone_DynamicTree.ts @@ -19,7 +19,7 @@ export const test_misc_createAssertClone_DynamicTree = _test_misc_assertClone( Object.keys(input).every((key: any) => { const value = input[key]; if (undefined === value) return true; - if (RegExp(/(.*)/).test(key)) + if (true) return ( "object" === typeof value && null !== value && @@ -82,7 +82,7 @@ export const test_misc_createAssertClone_DynamicTree = _test_misc_assertClone( Object.keys(input).every((key: any) => { const value = input[key]; if (undefined === value) return true; - if (RegExp(/(.*)/).test(key)) + if (true) return ( ((("object" === typeof value && null !== value) || @@ -133,7 +133,7 @@ export const test_misc_createAssertClone_DynamicTree = _test_misc_assertClone( Object.keys(input).every((key: any) => { const value = input[key]; if (undefined === value) return true; - if (RegExp(/(.*)/).test(key)) + if (true) return ( "object" === typeof value && null !== value && diff --git a/test/generated/output/misc.createAssertClone/test_misc_createAssertClone_DynamicUndefined.ts b/test/generated/output/misc.createAssertClone/test_misc_createAssertClone_DynamicUndefined.ts index 2d158da841..eddfb079d9 100644 --- a/test/generated/output/misc.createAssertClone/test_misc_createAssertClone_DynamicUndefined.ts +++ b/test/generated/output/misc.createAssertClone/test_misc_createAssertClone_DynamicUndefined.ts @@ -12,8 +12,7 @@ export const test_misc_createAssertClone_DynamicUndefined = Object.keys(input).every((key: any) => { const value = input[key]; if (undefined === value) return true; - if (RegExp(/(.*)/).test(key)) - return null !== value && undefined === value; + if (true) return null !== value && undefined === value; return true; }); return ( @@ -40,7 +39,7 @@ export const test_misc_createAssertClone_DynamicUndefined = Object.keys(input).every((key: any) => { const value = input[key]; if (undefined === value) return true; - if (RegExp(/(.*)/).test(key)) + if (true) return ( (null !== value || $guard(_exceptionable, { diff --git a/test/generated/output/misc.createAssertClone/test_misc_createAssertClone_DynamicUnion.ts b/test/generated/output/misc.createAssertClone/test_misc_createAssertClone_DynamicUnion.ts index 74f3629325..2d7b97451c 100644 --- a/test/generated/output/misc.createAssertClone/test_misc_createAssertClone_DynamicUnion.ts +++ b/test/generated/output/misc.createAssertClone/test_misc_createAssertClone_DynamicUnion.ts @@ -12,18 +12,24 @@ export const test_misc_createAssertClone_DynamicUnion = _test_misc_assertClone( const value = input[key]; if (undefined === value) return true; if ( - RegExp(/^[+-]?\d+(?:\.\d+)?(?:[eE][+-]?\d+)?$/).test( - key, - ) + "number" === typeof Number(key) && + Number.isFinite(Number(key)) ) return "string" === typeof value; - if (RegExp(/^(prefix_(.*))/).test(key)) + if ( + "string" === typeof key && + RegExp(/^prefix_(.*)/).test(key) + ) return "string" === typeof value; - if (RegExp(/((.*)_postfix)$/).test(key)) + if ( + "string" === typeof key && + RegExp(/(.*)_postfix$/).test(key) + ) return "string" === typeof value; if ( + "string" === typeof key && RegExp( - /^(value_between_[+-]?\d+(?:\.\d+)?(?:[eE][+-]?\d+)?_and_[+-]?\d+(?:\.\d+)?(?:[eE][+-]?\d+)?)$/, + /^value_between_[+-]?\d+(?:\.\d+)?(?:[eE][+-]?\d+)?_and_[+-]?\d+(?:\.\d+)?(?:[eE][+-]?\d+)?$/, ).test(key) ) return ( @@ -56,9 +62,8 @@ export const test_misc_createAssertClone_DynamicUnion = _test_misc_assertClone( const value = input[key]; if (undefined === value) return true; if ( - RegExp( - /^[+-]?\d+(?:\.\d+)?(?:[eE][+-]?\d+)?$/, - ).test(key) + "number" === typeof Number(key) && + Number.isFinite(Number(key)) ) return ( "string" === typeof value || @@ -68,7 +73,10 @@ export const test_misc_createAssertClone_DynamicUnion = _test_misc_assertClone( value: value, }) ); - if (RegExp(/^(prefix_(.*))/).test(key)) + if ( + "string" === typeof key && + RegExp(/^prefix_(.*)/).test(key) + ) return ( "string" === typeof value || $guard(_exceptionable, { @@ -77,7 +85,10 @@ export const test_misc_createAssertClone_DynamicUnion = _test_misc_assertClone( value: value, }) ); - if (RegExp(/((.*)_postfix)$/).test(key)) + if ( + "string" === typeof key && + RegExp(/(.*)_postfix$/).test(key) + ) return ( "string" === typeof value || $guard(_exceptionable, { @@ -87,8 +98,9 @@ export const test_misc_createAssertClone_DynamicUnion = _test_misc_assertClone( }) ); if ( + "string" === typeof key && RegExp( - /^(value_between_[+-]?\d+(?:\.\d+)?(?:[eE][+-]?\d+)?_and_[+-]?\d+(?:\.\d+)?(?:[eE][+-]?\d+)?)$/, + /^value_between_[+-]?\d+(?:\.\d+)?(?:[eE][+-]?\d+)?_and_[+-]?\d+(?:\.\d+)?(?:[eE][+-]?\d+)?$/, ).test(key) ) return ( diff --git a/test/generated/output/misc.createAssertClone/test_misc_createAssertClone_ObjectDynamic.ts b/test/generated/output/misc.createAssertClone/test_misc_createAssertClone_ObjectDynamic.ts index b5cbd47700..313f6ee5d3 100644 --- a/test/generated/output/misc.createAssertClone/test_misc_createAssertClone_ObjectDynamic.ts +++ b/test/generated/output/misc.createAssertClone/test_misc_createAssertClone_ObjectDynamic.ts @@ -11,7 +11,7 @@ export const test_misc_createAssertClone_ObjectDynamic = _test_misc_assertClone( Object.keys(input).every((key: any) => { const value = input[key]; if (undefined === value) return true; - if (RegExp(/(.*)/).test(key)) + if (true) return ( "string" === typeof value || ("number" === typeof value && @@ -44,7 +44,7 @@ export const test_misc_createAssertClone_ObjectDynamic = _test_misc_assertClone( Object.keys(input).every((key: any) => { const value = input[key]; if (undefined === value) return true; - if (RegExp(/(.*)/).test(key)) + if (true) return ( "string" === typeof value || ("number" === typeof value && diff --git a/test/generated/output/misc.createAssertClone/test_misc_createAssertClone_UltimateUnion.ts b/test/generated/output/misc.createAssertClone/test_misc_createAssertClone_UltimateUnion.ts index eec8f67026..5a0c2d2003 100644 --- a/test/generated/output/misc.createAssertClone/test_misc_createAssertClone_UltimateUnion.ts +++ b/test/generated/output/misc.createAssertClone/test_misc_createAssertClone_UltimateUnion.ts @@ -513,7 +513,7 @@ export const test_misc_createAssertClone_UltimateUnion = _test_misc_assertClone( Object.keys(input).every((key: any) => { const value = input[key]; if (undefined === value) return true; - if (RegExp(/(.*)/).test(key)) + if (true) return ( "object" === typeof value && null !== value && @@ -575,7 +575,7 @@ export const test_misc_createAssertClone_UltimateUnion = _test_misc_assertClone( Object.keys(input).every((key: any) => { const value = input[key]; if (undefined === value) return true; - if (RegExp(/(.*)/).test(key)) + if (true) return ( "object" === typeof value && null !== value && @@ -3311,7 +3311,7 @@ export const test_misc_createAssertClone_UltimateUnion = _test_misc_assertClone( Object.keys(input).every((key: any) => { const value = input[key]; if (undefined === value) return true; - if (RegExp(/(.*)/).test(key)) + if (true) return ( ((("object" === typeof value && null !== value && @@ -3557,7 +3557,7 @@ export const test_misc_createAssertClone_UltimateUnion = _test_misc_assertClone( Object.keys(input).every((key: any) => { const value = input[key]; if (undefined === value) return true; - if (RegExp(/(.*)/).test(key)) + if (true) return ( ((("object" === typeof value && null !== value && @@ -6293,7 +6293,7 @@ export const test_misc_createAssertClone_UltimateUnion = _test_misc_assertClone( Object.keys(input).every((key: any) => { const value = input[key]; if (undefined === value) return true; - if (RegExp(/(.*)/).test(key)) + if (true) return ( "object" === typeof value && null !== value && @@ -6352,7 +6352,7 @@ export const test_misc_createAssertClone_UltimateUnion = _test_misc_assertClone( Object.keys(input).every((key: any) => { const value = input[key]; if (undefined === value) return true; - if (RegExp(/(.*)/).test(key)) + if (true) return ( "object" === typeof value && null !== value && diff --git a/test/generated/output/misc.createAssertPrune/test_misc_createAssertPrune_DynamicComposite.ts b/test/generated/output/misc.createAssertPrune/test_misc_createAssertPrune_DynamicComposite.ts index 0e1162d1cf..3d4eed4ca5 100644 --- a/test/generated/output/misc.createAssertPrune/test_misc_createAssertPrune_DynamicComposite.ts +++ b/test/generated/output/misc.createAssertPrune/test_misc_createAssertPrune_DynamicComposite.ts @@ -17,21 +17,27 @@ export const test_misc_createAssertPrune_DynamicComposite = const value = input[key]; if (undefined === value) return true; if ( - RegExp( - /^[+-]?\d+(?:\.\d+)?(?:[eE][+-]?\d+)?$/, - ).test(key) + "number" === typeof Number(key) && + Number.isFinite(Number(key)) ) return ( "number" === typeof value && Number.isFinite(value) ); - if (RegExp(/^(prefix_(.*))/).test(key)) + if ( + "string" === typeof key && + RegExp(/^prefix_(.*)/).test(key) + ) return "string" === typeof value; - if (RegExp(/((.*)_postfix)$/).test(key)) + if ( + "string" === typeof key && + RegExp(/(.*)_postfix$/).test(key) + ) return "string" === typeof value; if ( + "string" === typeof key && RegExp( - /^(value_[+-]?\d+(?:\.\d+)?(?:[eE][+-]?\d+)?)$/, + /^value_[+-]?\d+(?:\.\d+)?(?:[eE][+-]?\d+)?$/, ).test(key) ) return ( @@ -41,8 +47,9 @@ export const test_misc_createAssertPrune_DynamicComposite = "boolean" === typeof value ); if ( + "string" === typeof key && RegExp( - /^(between_(.*)_and_[+-]?\d+(?:\.\d+)?(?:[eE][+-]?\d+)?)$/, + /^between_(.*)_and_[+-]?\d+(?:\.\d+)?(?:[eE][+-]?\d+)?$/, ).test(key) ) return "boolean" === typeof value; @@ -88,9 +95,8 @@ export const test_misc_createAssertPrune_DynamicComposite = const value = input[key]; if (undefined === value) return true; if ( - RegExp( - /^[+-]?\d+(?:\.\d+)?(?:[eE][+-]?\d+)?$/, - ).test(key) + "number" === typeof Number(key) && + Number.isFinite(Number(key)) ) return ( ("number" === typeof value && @@ -101,7 +107,10 @@ export const test_misc_createAssertPrune_DynamicComposite = value: value, }) ); - if (RegExp(/^(prefix_(.*))/).test(key)) + if ( + "string" === typeof key && + RegExp(/^prefix_(.*)/).test(key) + ) return ( "string" === typeof value || $guard(_exceptionable, { @@ -110,7 +119,10 @@ export const test_misc_createAssertPrune_DynamicComposite = value: value, }) ); - if (RegExp(/((.*)_postfix)$/).test(key)) + if ( + "string" === typeof key && + RegExp(/(.*)_postfix$/).test(key) + ) return ( "string" === typeof value || $guard(_exceptionable, { @@ -120,8 +132,9 @@ export const test_misc_createAssertPrune_DynamicComposite = }) ); if ( + "string" === typeof key && RegExp( - /^(value_[+-]?\d+(?:\.\d+)?(?:[eE][+-]?\d+)?)$/, + /^value_[+-]?\d+(?:\.\d+)?(?:[eE][+-]?\d+)?$/, ).test(key) ) return ( @@ -137,8 +150,9 @@ export const test_misc_createAssertPrune_DynamicComposite = }) ); if ( + "string" === typeof key && RegExp( - /^(between_(.*)_and_[+-]?\d+(?:\.\d+)?(?:[eE][+-]?\d+)?)$/, + /^between_(.*)_and_[+-]?\d+(?:\.\d+)?(?:[eE][+-]?\d+)?$/, ).test(key) ) return ( diff --git a/test/generated/output/misc.createAssertPrune/test_misc_createAssertPrune_DynamicTag.ts b/test/generated/output/misc.createAssertPrune/test_misc_createAssertPrune_DynamicTag.ts new file mode 100644 index 0000000000..0288f2f95f --- /dev/null +++ b/test/generated/output/misc.createAssertPrune/test_misc_createAssertPrune_DynamicTag.ts @@ -0,0 +1,144 @@ +import typia from "../../../../src"; +import { _test_misc_assertPrune } from "../../../internal/_test_misc_assertPrune"; +import { DynamicTag } from "../../../structures/DynamicTag"; + +export const test_misc_createAssertPrune_DynamicTag = _test_misc_assertPrune( + "DynamicTag", +)(DynamicTag)((input: any): DynamicTag => { + const assert = (input: any): DynamicTag => { + const __is = (input: any): input is DynamicTag => { + const $io0 = (input: any): boolean => + Object.keys(input).every((key: any) => { + const value = input[key]; + if (undefined === value) return true; + if ( + "number" === typeof Number(key) && + 0 <= Number(key) && + Number(key) < 10 + ) + return "bigint" === typeof value && BigInt(0) <= value; + if ( + "string" === typeof key && + /^(?:[0-9a-f]{8}-[0-9a-f]{4}-[1-5][0-9a-f]{3}-[89ab][0-9a-f]{3}-[0-9a-f]{12}|00000000-0000-0000-0000-000000000000)$/i.test( + key, + ) + ) + return ( + "string" === typeof value && + /^(([^<>()[\]\.,;:\s@\"]+(\.[^<>()[\]\.,;:\s@\"]+)*)|(\".+\"))@(([^<>()[\]\.,;:\s@\"]+\.)+[^<>()[\]\.,;:\s@\"]{2,})$/i.test( + value, + ) + ); + return true; + }); + return ( + "object" === typeof input && + null !== input && + false === Array.isArray(input) && + $io0(input) + ); + }; + if (false === __is(input)) + (( + input: any, + _path: string, + _exceptionable: boolean = true, + ): input is DynamicTag => { + const $guard = (typia.misc.createAssertPrune as any).guard; + const $join = (typia.misc.createAssertPrune as any).join; + const $ao0 = ( + input: any, + _path: string, + _exceptionable: boolean = true, + ): boolean => + false === _exceptionable || + Object.keys(input).every((key: any) => { + const value = input[key]; + if (undefined === value) return true; + if ( + "number" === typeof Number(key) && + 0 <= Number(key) && + Number(key) < 10 + ) + return ( + ("bigint" === typeof value && + (BigInt(0) <= value || + $guard(_exceptionable, { + path: _path + $join(key), + expected: 'bigint & Type<"uint64">', + value: value, + }))) || + $guard(_exceptionable, { + path: _path + $join(key), + expected: '(bigint & Type<"uint64">)', + value: value, + }) + ); + if ( + "string" === typeof key && + /^(?:[0-9a-f]{8}-[0-9a-f]{4}-[1-5][0-9a-f]{3}-[89ab][0-9a-f]{3}-[0-9a-f]{12}|00000000-0000-0000-0000-000000000000)$/i.test( + key, + ) + ) + return ( + ("string" === typeof value && + (/^(([^<>()[\]\.,;:\s@\"]+(\.[^<>()[\]\.,;:\s@\"]+)*)|(\".+\"))@(([^<>()[\]\.,;:\s@\"]+\.)+[^<>()[\]\.,;:\s@\"]{2,})$/i.test( + value, + ) || + $guard(_exceptionable, { + path: _path + $join(key), + expected: + 'string & Format<"email">', + value: value, + }))) || + $guard(_exceptionable, { + path: _path + $join(key), + expected: '(string & Format<"email">)', + value: value, + }) + ); + return true; + }); + return ( + ((("object" === typeof input && + null !== input && + false === Array.isArray(input)) || + $guard(true, { + path: _path + "", + expected: "DynamicTag", + value: input, + })) && + $ao0(input, _path + "", true)) || + $guard(true, { + path: _path + "", + expected: "DynamicTag", + value: input, + }) + ); + })(input, "$input", true); + return input; + }; + const prune = (input: DynamicTag): void => { + const $po0 = (input: any): any => { + Object.entries(input).forEach(([key, value]: any) => { + if (undefined === value) return; + if (RegExp(/^[+-]?\d+(?:\.\d+)?(?:[eE][+-]?\d+)?$/).test(key)) { + } + if (RegExp(/(.*)/).test(key)) { + } + }); + for (const key of Object.keys(input)) { + if ( + RegExp(/^[+-]?\d+(?:\.\d+)?(?:[eE][+-]?\d+)?$/).test(key) || + RegExp(/(.*)/).test(key) + ) + continue; + delete input[key]; + } + }; + if ("object" === typeof input && null !== input) $po0(input); + }; + assert(input); + prune(input); + return input; +}); diff --git a/test/generated/output/misc.createAssertPrune/test_misc_createAssertPrune_DynamicTemplate.ts b/test/generated/output/misc.createAssertPrune/test_misc_createAssertPrune_DynamicTemplate.ts index e0baacea6e..3b56b73a10 100644 --- a/test/generated/output/misc.createAssertPrune/test_misc_createAssertPrune_DynamicTemplate.ts +++ b/test/generated/output/misc.createAssertPrune/test_misc_createAssertPrune_DynamicTemplate.ts @@ -11,13 +11,20 @@ export const test_misc_createAssertPrune_DynamicTemplate = Object.keys(input).every((key: any) => { const value = input[key]; if (undefined === value) return true; - if (RegExp(/^(prefix_(.*))/).test(key)) + if ( + "string" === typeof key && + RegExp(/^prefix_(.*)/).test(key) + ) return "string" === typeof value; - if (RegExp(/((.*)_postfix)$/).test(key)) + if ( + "string" === typeof key && + RegExp(/(.*)_postfix$/).test(key) + ) return "string" === typeof value; if ( + "string" === typeof key && RegExp( - /^(value_[+-]?\d+(?:\.\d+)?(?:[eE][+-]?\d+)?)$/, + /^value_[+-]?\d+(?:\.\d+)?(?:[eE][+-]?\d+)?$/, ).test(key) ) return ( @@ -25,8 +32,9 @@ export const test_misc_createAssertPrune_DynamicTemplate = Number.isFinite(value) ); if ( + "string" === typeof key && RegExp( - /^(between_(.*)_and_[+-]?\d+(?:\.\d+)?(?:[eE][+-]?\d+)?)$/, + /^between_(.*)_and_[+-]?\d+(?:\.\d+)?(?:[eE][+-]?\d+)?$/, ).test(key) ) return "boolean" === typeof value; @@ -58,7 +66,10 @@ export const test_misc_createAssertPrune_DynamicTemplate = Object.keys(input).every((key: any) => { const value = input[key]; if (undefined === value) return true; - if (RegExp(/^(prefix_(.*))/).test(key)) + if ( + "string" === typeof key && + RegExp(/^prefix_(.*)/).test(key) + ) return ( "string" === typeof value || $guard(_exceptionable, { @@ -67,7 +78,10 @@ export const test_misc_createAssertPrune_DynamicTemplate = value: value, }) ); - if (RegExp(/((.*)_postfix)$/).test(key)) + if ( + "string" === typeof key && + RegExp(/(.*)_postfix$/).test(key) + ) return ( "string" === typeof value || $guard(_exceptionable, { @@ -77,8 +91,9 @@ export const test_misc_createAssertPrune_DynamicTemplate = }) ); if ( + "string" === typeof key && RegExp( - /^(value_[+-]?\d+(?:\.\d+)?(?:[eE][+-]?\d+)?)$/, + /^value_[+-]?\d+(?:\.\d+)?(?:[eE][+-]?\d+)?$/, ).test(key) ) return ( @@ -91,8 +106,9 @@ export const test_misc_createAssertPrune_DynamicTemplate = }) ); if ( + "string" === typeof key && RegExp( - /^(between_(.*)_and_[+-]?\d+(?:\.\d+)?(?:[eE][+-]?\d+)?)$/, + /^between_(.*)_and_[+-]?\d+(?:\.\d+)?(?:[eE][+-]?\d+)?$/, ).test(key) ) return ( diff --git a/test/generated/output/misc.createAssertPrune/test_misc_createAssertPrune_DynamicUnion.ts b/test/generated/output/misc.createAssertPrune/test_misc_createAssertPrune_DynamicUnion.ts index 989d92e825..aa76adfe0d 100644 --- a/test/generated/output/misc.createAssertPrune/test_misc_createAssertPrune_DynamicUnion.ts +++ b/test/generated/output/misc.createAssertPrune/test_misc_createAssertPrune_DynamicUnion.ts @@ -12,18 +12,24 @@ export const test_misc_createAssertPrune_DynamicUnion = _test_misc_assertPrune( const value = input[key]; if (undefined === value) return true; if ( - RegExp(/^[+-]?\d+(?:\.\d+)?(?:[eE][+-]?\d+)?$/).test( - key, - ) + "number" === typeof Number(key) && + Number.isFinite(Number(key)) ) return "string" === typeof value; - if (RegExp(/^(prefix_(.*))/).test(key)) + if ( + "string" === typeof key && + RegExp(/^prefix_(.*)/).test(key) + ) return "string" === typeof value; - if (RegExp(/((.*)_postfix)$/).test(key)) + if ( + "string" === typeof key && + RegExp(/(.*)_postfix$/).test(key) + ) return "string" === typeof value; if ( + "string" === typeof key && RegExp( - /^(value_between_[+-]?\d+(?:\.\d+)?(?:[eE][+-]?\d+)?_and_[+-]?\d+(?:\.\d+)?(?:[eE][+-]?\d+)?)$/, + /^value_between_[+-]?\d+(?:\.\d+)?(?:[eE][+-]?\d+)?_and_[+-]?\d+(?:\.\d+)?(?:[eE][+-]?\d+)?$/, ).test(key) ) return ( @@ -56,9 +62,8 @@ export const test_misc_createAssertPrune_DynamicUnion = _test_misc_assertPrune( const value = input[key]; if (undefined === value) return true; if ( - RegExp( - /^[+-]?\d+(?:\.\d+)?(?:[eE][+-]?\d+)?$/, - ).test(key) + "number" === typeof Number(key) && + Number.isFinite(Number(key)) ) return ( "string" === typeof value || @@ -68,7 +73,10 @@ export const test_misc_createAssertPrune_DynamicUnion = _test_misc_assertPrune( value: value, }) ); - if (RegExp(/^(prefix_(.*))/).test(key)) + if ( + "string" === typeof key && + RegExp(/^prefix_(.*)/).test(key) + ) return ( "string" === typeof value || $guard(_exceptionable, { @@ -77,7 +85,10 @@ export const test_misc_createAssertPrune_DynamicUnion = _test_misc_assertPrune( value: value, }) ); - if (RegExp(/((.*)_postfix)$/).test(key)) + if ( + "string" === typeof key && + RegExp(/(.*)_postfix$/).test(key) + ) return ( "string" === typeof value || $guard(_exceptionable, { @@ -87,8 +98,9 @@ export const test_misc_createAssertPrune_DynamicUnion = _test_misc_assertPrune( }) ); if ( + "string" === typeof key && RegExp( - /^(value_between_[+-]?\d+(?:\.\d+)?(?:[eE][+-]?\d+)?_and_[+-]?\d+(?:\.\d+)?(?:[eE][+-]?\d+)?)$/, + /^value_between_[+-]?\d+(?:\.\d+)?(?:[eE][+-]?\d+)?_and_[+-]?\d+(?:\.\d+)?(?:[eE][+-]?\d+)?$/, ).test(key) ) return ( diff --git a/test/generated/output/misc.createClone/test_misc_createClone_DynamicArray.ts b/test/generated/output/misc.createClone/test_misc_createClone_DynamicArray.ts index 4f7af858c9..83501c983d 100644 --- a/test/generated/output/misc.createClone/test_misc_createClone_DynamicArray.ts +++ b/test/generated/output/misc.createClone/test_misc_createClone_DynamicArray.ts @@ -10,7 +10,7 @@ export const test_misc_createClone_DynamicArray = _test_misc_clone( Object.keys(input).every((key: any) => { const value = input[key]; if (undefined === value) return true; - if (RegExp(/(.*)/).test(key)) + if (true) return ( Array.isArray(value) && value.every((elem: any) => "string" === typeof elem) diff --git a/test/generated/output/misc.createClone/test_misc_createClone_DynamicSimple.ts b/test/generated/output/misc.createClone/test_misc_createClone_DynamicSimple.ts index bdaef21e7e..92baa1c37d 100644 --- a/test/generated/output/misc.createClone/test_misc_createClone_DynamicSimple.ts +++ b/test/generated/output/misc.createClone/test_misc_createClone_DynamicSimple.ts @@ -10,7 +10,7 @@ export const test_misc_createClone_DynamicSimple = _test_misc_clone( Object.keys(input).every((key: any) => { const value = input[key]; if (undefined === value) return true; - if (RegExp(/(.*)/).test(key)) return "number" === typeof value; + if (true) return "number" === typeof value; return true; }); const $co0 = (input: any): any => ({ diff --git a/test/generated/output/misc.createClone/test_misc_createClone_DynamicTree.ts b/test/generated/output/misc.createClone/test_misc_createClone_DynamicTree.ts index 960f4e8288..0ca3f46212 100644 --- a/test/generated/output/misc.createClone/test_misc_createClone_DynamicTree.ts +++ b/test/generated/output/misc.createClone/test_misc_createClone_DynamicTree.ts @@ -17,7 +17,7 @@ export const test_misc_createClone_DynamicTree = _test_misc_clone( Object.keys(input).every((key: any) => { const value = input[key]; if (undefined === value) return true; - if (RegExp(/(.*)/).test(key)) + if (true) return ( "object" === typeof value && null !== value && diff --git a/test/generated/output/misc.createClone/test_misc_createClone_UltimateUnion.ts b/test/generated/output/misc.createClone/test_misc_createClone_UltimateUnion.ts index e76c3c4c5b..593534f029 100644 --- a/test/generated/output/misc.createClone/test_misc_createClone_UltimateUnion.ts +++ b/test/generated/output/misc.createClone/test_misc_createClone_UltimateUnion.ts @@ -474,7 +474,7 @@ export const test_misc_createClone_UltimateUnion = _test_misc_clone( Object.keys(input).every((key: any) => { const value = input[key]; if (undefined === value) return true; - if (RegExp(/(.*)/).test(key)) + if (true) return ( "object" === typeof value && null !== value && @@ -533,7 +533,7 @@ export const test_misc_createClone_UltimateUnion = _test_misc_clone( Object.keys(input).every((key: any) => { const value = input[key]; if (undefined === value) return true; - if (RegExp(/(.*)/).test(key)) + if (true) return ( "object" === typeof value && null !== value && diff --git a/test/generated/output/misc.createIsClone/test_misc_createIsClone_DynamicArray.ts b/test/generated/output/misc.createIsClone/test_misc_createIsClone_DynamicArray.ts index 5b3ec019b8..7f34a5c4a8 100644 --- a/test/generated/output/misc.createIsClone/test_misc_createIsClone_DynamicArray.ts +++ b/test/generated/output/misc.createIsClone/test_misc_createIsClone_DynamicArray.ts @@ -16,7 +16,7 @@ export const test_misc_createIsClone_DynamicArray = _test_misc_isClone( Object.keys(input).every((key: any) => { const value = input[key]; if (undefined === value) return true; - if (RegExp(/(.*)/).test(key)) + if (true) return ( Array.isArray(value) && value.every((elem: any) => "string" === typeof elem) @@ -30,7 +30,7 @@ export const test_misc_createIsClone_DynamicArray = _test_misc_isClone( Object.keys(input).every((key: any) => { const value = input[key]; if (undefined === value) return true; - if (RegExp(/(.*)/).test(key)) + if (true) return ( Array.isArray(value) && value.every((elem: any) => "string" === typeof elem) diff --git a/test/generated/output/misc.createIsClone/test_misc_createIsClone_DynamicComposite.ts b/test/generated/output/misc.createIsClone/test_misc_createIsClone_DynamicComposite.ts index b96518c6a4..3175c34787 100644 --- a/test/generated/output/misc.createIsClone/test_misc_createIsClone_DynamicComposite.ts +++ b/test/generated/output/misc.createIsClone/test_misc_createIsClone_DynamicComposite.ts @@ -16,20 +16,26 @@ export const test_misc_createIsClone_DynamicComposite = _test_misc_isClone( const value = input[key]; if (undefined === value) return true; if ( - RegExp(/^[+-]?\d+(?:\.\d+)?(?:[eE][+-]?\d+)?$/).test( - key, - ) + "number" === typeof Number(key) && + Number.isFinite(Number(key)) ) return ( "number" === typeof value && Number.isFinite(value) ); - if (RegExp(/^(prefix_(.*))/).test(key)) + if ( + "string" === typeof key && + RegExp(/^prefix_(.*)/).test(key) + ) return "string" === typeof value; - if (RegExp(/((.*)_postfix)$/).test(key)) + if ( + "string" === typeof key && + RegExp(/(.*)_postfix$/).test(key) + ) return "string" === typeof value; if ( + "string" === typeof key && RegExp( - /^(value_[+-]?\d+(?:\.\d+)?(?:[eE][+-]?\d+)?)$/, + /^value_[+-]?\d+(?:\.\d+)?(?:[eE][+-]?\d+)?$/, ).test(key) ) return ( @@ -39,8 +45,9 @@ export const test_misc_createIsClone_DynamicComposite = _test_misc_isClone( "boolean" === typeof value ); if ( + "string" === typeof key && RegExp( - /^(between_(.*)_and_[+-]?\d+(?:\.\d+)?(?:[eE][+-]?\d+)?)$/, + /^between_(.*)_and_[+-]?\d+(?:\.\d+)?(?:[eE][+-]?\d+)?$/, ).test(key) ) return "boolean" === typeof value; diff --git a/test/generated/output/misc.createIsClone/test_misc_createIsClone_DynamicNever.ts b/test/generated/output/misc.createIsClone/test_misc_createIsClone_DynamicNever.ts index 66c6143ecb..6451320fad 100644 --- a/test/generated/output/misc.createIsClone/test_misc_createIsClone_DynamicNever.ts +++ b/test/generated/output/misc.createIsClone/test_misc_createIsClone_DynamicNever.ts @@ -11,8 +11,7 @@ export const test_misc_createIsClone_DynamicNever = _test_misc_isClone( Object.keys(input).every((key: any) => { const value = input[key]; if (undefined === value) return true; - if (RegExp(/(.*)/).test(key)) - return null !== value && undefined === value; + if (true) return null !== value && undefined === value; return true; }); return ( diff --git a/test/generated/output/misc.createIsClone/test_misc_createIsClone_DynamicSimple.ts b/test/generated/output/misc.createIsClone/test_misc_createIsClone_DynamicSimple.ts index 4a3d3e8d3c..337852d12c 100644 --- a/test/generated/output/misc.createIsClone/test_misc_createIsClone_DynamicSimple.ts +++ b/test/generated/output/misc.createIsClone/test_misc_createIsClone_DynamicSimple.ts @@ -16,7 +16,7 @@ export const test_misc_createIsClone_DynamicSimple = _test_misc_isClone( Object.keys(input).every((key: any) => { const value = input[key]; if (undefined === value) return true; - if (RegExp(/(.*)/).test(key)) + if (true) return ( "number" === typeof value && Number.isFinite(value) ); @@ -29,8 +29,7 @@ export const test_misc_createIsClone_DynamicSimple = _test_misc_isClone( Object.keys(input).every((key: any) => { const value = input[key]; if (undefined === value) return true; - if (RegExp(/(.*)/).test(key)) - return "number" === typeof value; + if (true) return "number" === typeof value; return true; }); const $co0 = (input: any): any => ({ diff --git a/test/generated/output/misc.createIsClone/test_misc_createIsClone_DynamicTemplate.ts b/test/generated/output/misc.createIsClone/test_misc_createIsClone_DynamicTemplate.ts index d0e2339ce3..7431dc00db 100644 --- a/test/generated/output/misc.createIsClone/test_misc_createIsClone_DynamicTemplate.ts +++ b/test/generated/output/misc.createIsClone/test_misc_createIsClone_DynamicTemplate.ts @@ -11,21 +11,29 @@ export const test_misc_createIsClone_DynamicTemplate = _test_misc_isClone( Object.keys(input).every((key: any) => { const value = input[key]; if (undefined === value) return true; - if (RegExp(/^(prefix_(.*))/).test(key)) + if ( + "string" === typeof key && + RegExp(/^prefix_(.*)/).test(key) + ) return "string" === typeof value; - if (RegExp(/((.*)_postfix)$/).test(key)) + if ( + "string" === typeof key && + RegExp(/(.*)_postfix$/).test(key) + ) return "string" === typeof value; if ( + "string" === typeof key && RegExp( - /^(value_[+-]?\d+(?:\.\d+)?(?:[eE][+-]?\d+)?)$/, + /^value_[+-]?\d+(?:\.\d+)?(?:[eE][+-]?\d+)?$/, ).test(key) ) return ( "number" === typeof value && Number.isFinite(value) ); if ( + "string" === typeof key && RegExp( - /^(between_(.*)_and_[+-]?\d+(?:\.\d+)?(?:[eE][+-]?\d+)?)$/, + /^between_(.*)_and_[+-]?\d+(?:\.\d+)?(?:[eE][+-]?\d+)?$/, ).test(key) ) return "boolean" === typeof value; diff --git a/test/generated/output/misc.createIsClone/test_misc_createIsClone_DynamicTree.ts b/test/generated/output/misc.createIsClone/test_misc_createIsClone_DynamicTree.ts index c7a8eb40c0..520b57905d 100644 --- a/test/generated/output/misc.createIsClone/test_misc_createIsClone_DynamicTree.ts +++ b/test/generated/output/misc.createIsClone/test_misc_createIsClone_DynamicTree.ts @@ -19,7 +19,7 @@ export const test_misc_createIsClone_DynamicTree = _test_misc_isClone( Object.keys(input).every((key: any) => { const value = input[key]; if (undefined === value) return true; - if (RegExp(/(.*)/).test(key)) + if (true) return ( "object" === typeof value && null !== value && @@ -41,7 +41,7 @@ export const test_misc_createIsClone_DynamicTree = _test_misc_isClone( Object.keys(input).every((key: any) => { const value = input[key]; if (undefined === value) return true; - if (RegExp(/(.*)/).test(key)) + if (true) return ( "object" === typeof value && null !== value && diff --git a/test/generated/output/misc.createIsClone/test_misc_createIsClone_DynamicUndefined.ts b/test/generated/output/misc.createIsClone/test_misc_createIsClone_DynamicUndefined.ts index 8cfa2cce4e..101ecd2642 100644 --- a/test/generated/output/misc.createIsClone/test_misc_createIsClone_DynamicUndefined.ts +++ b/test/generated/output/misc.createIsClone/test_misc_createIsClone_DynamicUndefined.ts @@ -11,8 +11,7 @@ export const test_misc_createIsClone_DynamicUndefined = _test_misc_isClone( Object.keys(input).every((key: any) => { const value = input[key]; if (undefined === value) return true; - if (RegExp(/(.*)/).test(key)) - return null !== value && undefined === value; + if (true) return null !== value && undefined === value; return true; }); return ( diff --git a/test/generated/output/misc.createIsClone/test_misc_createIsClone_DynamicUnion.ts b/test/generated/output/misc.createIsClone/test_misc_createIsClone_DynamicUnion.ts index e142cb30d4..cb87726e00 100644 --- a/test/generated/output/misc.createIsClone/test_misc_createIsClone_DynamicUnion.ts +++ b/test/generated/output/misc.createIsClone/test_misc_createIsClone_DynamicUnion.ts @@ -12,18 +12,24 @@ export const test_misc_createIsClone_DynamicUnion = _test_misc_isClone( const value = input[key]; if (undefined === value) return true; if ( - RegExp(/^[+-]?\d+(?:\.\d+)?(?:[eE][+-]?\d+)?$/).test( - key, - ) + "number" === typeof Number(key) && + Number.isFinite(Number(key)) ) return "string" === typeof value; - if (RegExp(/^(prefix_(.*))/).test(key)) + if ( + "string" === typeof key && + RegExp(/^prefix_(.*)/).test(key) + ) return "string" === typeof value; - if (RegExp(/((.*)_postfix)$/).test(key)) + if ( + "string" === typeof key && + RegExp(/(.*)_postfix$/).test(key) + ) return "string" === typeof value; if ( + "string" === typeof key && RegExp( - /^(value_between_[+-]?\d+(?:\.\d+)?(?:[eE][+-]?\d+)?_and_[+-]?\d+(?:\.\d+)?(?:[eE][+-]?\d+)?)$/, + /^value_between_[+-]?\d+(?:\.\d+)?(?:[eE][+-]?\d+)?_and_[+-]?\d+(?:\.\d+)?(?:[eE][+-]?\d+)?$/, ).test(key) ) return ( diff --git a/test/generated/output/misc.createIsClone/test_misc_createIsClone_ObjectDynamic.ts b/test/generated/output/misc.createIsClone/test_misc_createIsClone_ObjectDynamic.ts index d309a5b8b2..d661a21fd9 100644 --- a/test/generated/output/misc.createIsClone/test_misc_createIsClone_ObjectDynamic.ts +++ b/test/generated/output/misc.createIsClone/test_misc_createIsClone_ObjectDynamic.ts @@ -11,7 +11,7 @@ export const test_misc_createIsClone_ObjectDynamic = _test_misc_isClone( Object.keys(input).every((key: any) => { const value = input[key]; if (undefined === value) return true; - if (RegExp(/(.*)/).test(key)) + if (true) return ( "string" === typeof value || ("number" === typeof value && diff --git a/test/generated/output/misc.createIsClone/test_misc_createIsClone_UltimateUnion.ts b/test/generated/output/misc.createIsClone/test_misc_createIsClone_UltimateUnion.ts index 62d8172d24..05bdc5435d 100644 --- a/test/generated/output/misc.createIsClone/test_misc_createIsClone_UltimateUnion.ts +++ b/test/generated/output/misc.createIsClone/test_misc_createIsClone_UltimateUnion.ts @@ -513,7 +513,7 @@ export const test_misc_createIsClone_UltimateUnion = _test_misc_isClone( Object.keys(input).every((key: any) => { const value = input[key]; if (undefined === value) return true; - if (RegExp(/(.*)/).test(key)) + if (true) return ( "object" === typeof value && null !== value && @@ -575,7 +575,7 @@ export const test_misc_createIsClone_UltimateUnion = _test_misc_isClone( Object.keys(input).every((key: any) => { const value = input[key]; if (undefined === value) return true; - if (RegExp(/(.*)/).test(key)) + if (true) return ( "object" === typeof value && null !== value && @@ -1639,7 +1639,7 @@ export const test_misc_createIsClone_UltimateUnion = _test_misc_isClone( Object.keys(input).every((key: any) => { const value = input[key]; if (undefined === value) return true; - if (RegExp(/(.*)/).test(key)) + if (true) return ( "object" === typeof value && null !== value && @@ -1701,7 +1701,7 @@ export const test_misc_createIsClone_UltimateUnion = _test_misc_isClone( Object.keys(input).every((key: any) => { const value = input[key]; if (undefined === value) return true; - if (RegExp(/(.*)/).test(key)) + if (true) return ( "object" === typeof value && null !== value && diff --git a/test/generated/output/misc.createIsPrune/test_misc_createIsPrune_DynamicComposite.ts b/test/generated/output/misc.createIsPrune/test_misc_createIsPrune_DynamicComposite.ts index 9090e63203..afafbdf077 100644 --- a/test/generated/output/misc.createIsPrune/test_misc_createIsPrune_DynamicComposite.ts +++ b/test/generated/output/misc.createIsPrune/test_misc_createIsPrune_DynamicComposite.ts @@ -16,20 +16,26 @@ export const test_misc_createIsPrune_DynamicComposite = _test_misc_isPrune( const value = input[key]; if (undefined === value) return true; if ( - RegExp(/^[+-]?\d+(?:\.\d+)?(?:[eE][+-]?\d+)?$/).test( - key, - ) + "number" === typeof Number(key) && + Number.isFinite(Number(key)) ) return ( "number" === typeof value && Number.isFinite(value) ); - if (RegExp(/^(prefix_(.*))/).test(key)) + if ( + "string" === typeof key && + RegExp(/^prefix_(.*)/).test(key) + ) return "string" === typeof value; - if (RegExp(/((.*)_postfix)$/).test(key)) + if ( + "string" === typeof key && + RegExp(/(.*)_postfix$/).test(key) + ) return "string" === typeof value; if ( + "string" === typeof key && RegExp( - /^(value_[+-]?\d+(?:\.\d+)?(?:[eE][+-]?\d+)?)$/, + /^value_[+-]?\d+(?:\.\d+)?(?:[eE][+-]?\d+)?$/, ).test(key) ) return ( @@ -39,8 +45,9 @@ export const test_misc_createIsPrune_DynamicComposite = _test_misc_isPrune( "boolean" === typeof value ); if ( + "string" === typeof key && RegExp( - /^(between_(.*)_and_[+-]?\d+(?:\.\d+)?(?:[eE][+-]?\d+)?)$/, + /^between_(.*)_and_[+-]?\d+(?:\.\d+)?(?:[eE][+-]?\d+)?$/, ).test(key) ) return "boolean" === typeof value; diff --git a/test/generated/output/misc.createIsPrune/test_misc_createIsPrune_DynamicTag.ts b/test/generated/output/misc.createIsPrune/test_misc_createIsPrune_DynamicTag.ts new file mode 100644 index 0000000000..1a0ecf730c --- /dev/null +++ b/test/generated/output/misc.createIsPrune/test_misc_createIsPrune_DynamicTag.ts @@ -0,0 +1,63 @@ +import typia from "../../../../src"; +import { _test_misc_isPrune } from "../../../internal/_test_misc_isPrune"; +import { DynamicTag } from "../../../structures/DynamicTag"; + +export const test_misc_createIsPrune_DynamicTag = _test_misc_isPrune( + "DynamicTag", +)(DynamicTag)((input: any): input is DynamicTag => { + const is = (input: any): input is DynamicTag => { + const $io0 = (input: any): boolean => + Object.keys(input).every((key: any) => { + const value = input[key]; + if (undefined === value) return true; + if ( + "number" === typeof Number(key) && + 0 <= Number(key) && + Number(key) < 10 + ) + return "bigint" === typeof value && BigInt(0) <= value; + if ( + "string" === typeof key && + /^(?:[0-9a-f]{8}-[0-9a-f]{4}-[1-5][0-9a-f]{3}-[89ab][0-9a-f]{3}-[0-9a-f]{12}|00000000-0000-0000-0000-000000000000)$/i.test( + key, + ) + ) + return ( + "string" === typeof value && + /^(([^<>()[\]\.,;:\s@\"]+(\.[^<>()[\]\.,;:\s@\"]+)*)|(\".+\"))@(([^<>()[\]\.,;:\s@\"]+\.)+[^<>()[\]\.,;:\s@\"]{2,})$/i.test( + value, + ) + ); + return true; + }); + return ( + "object" === typeof input && + null !== input && + false === Array.isArray(input) && + $io0(input) + ); + }; + const prune = (input: DynamicTag): void => { + const $po0 = (input: any): any => { + Object.entries(input).forEach(([key, value]: any) => { + if (undefined === value) return; + if (RegExp(/^[+-]?\d+(?:\.\d+)?(?:[eE][+-]?\d+)?$/).test(key)) { + } + if (RegExp(/(.*)/).test(key)) { + } + }); + for (const key of Object.keys(input)) { + if ( + RegExp(/^[+-]?\d+(?:\.\d+)?(?:[eE][+-]?\d+)?$/).test(key) || + RegExp(/(.*)/).test(key) + ) + continue; + delete input[key]; + } + }; + if ("object" === typeof input && null !== input) $po0(input); + }; + if (!is(input)) return false; + prune(input); + return true; +}); diff --git a/test/generated/output/misc.createIsPrune/test_misc_createIsPrune_DynamicTemplate.ts b/test/generated/output/misc.createIsPrune/test_misc_createIsPrune_DynamicTemplate.ts index ee69d6b3cd..35afd7ee18 100644 --- a/test/generated/output/misc.createIsPrune/test_misc_createIsPrune_DynamicTemplate.ts +++ b/test/generated/output/misc.createIsPrune/test_misc_createIsPrune_DynamicTemplate.ts @@ -10,19 +10,24 @@ export const test_misc_createIsPrune_DynamicTemplate = _test_misc_isPrune( Object.keys(input).every((key: any) => { const value = input[key]; if (undefined === value) return true; - if (RegExp(/^(prefix_(.*))/).test(key)) + if ("string" === typeof key && RegExp(/^prefix_(.*)/).test(key)) return "string" === typeof value; - if (RegExp(/((.*)_postfix)$/).test(key)) + if ( + "string" === typeof key && + RegExp(/(.*)_postfix$/).test(key) + ) return "string" === typeof value; if ( - RegExp( - /^(value_[+-]?\d+(?:\.\d+)?(?:[eE][+-]?\d+)?)$/, - ).test(key) + "string" === typeof key && + RegExp(/^value_[+-]?\d+(?:\.\d+)?(?:[eE][+-]?\d+)?$/).test( + key, + ) ) return "number" === typeof value && Number.isFinite(value); if ( + "string" === typeof key && RegExp( - /^(between_(.*)_and_[+-]?\d+(?:\.\d+)?(?:[eE][+-]?\d+)?)$/, + /^between_(.*)_and_[+-]?\d+(?:\.\d+)?(?:[eE][+-]?\d+)?$/, ).test(key) ) return "boolean" === typeof value; diff --git a/test/generated/output/misc.createIsPrune/test_misc_createIsPrune_DynamicUnion.ts b/test/generated/output/misc.createIsPrune/test_misc_createIsPrune_DynamicUnion.ts index 147d5f8e13..3504429599 100644 --- a/test/generated/output/misc.createIsPrune/test_misc_createIsPrune_DynamicUnion.ts +++ b/test/generated/output/misc.createIsPrune/test_misc_createIsPrune_DynamicUnion.ts @@ -10,15 +10,22 @@ export const test_misc_createIsPrune_DynamicUnion = _test_misc_isPrune( Object.keys(input).every((key: any) => { const value = input[key]; if (undefined === value) return true; - if (RegExp(/^[+-]?\d+(?:\.\d+)?(?:[eE][+-]?\d+)?$/).test(key)) + if ( + "number" === typeof Number(key) && + Number.isFinite(Number(key)) + ) return "string" === typeof value; - if (RegExp(/^(prefix_(.*))/).test(key)) + if ("string" === typeof key && RegExp(/^prefix_(.*)/).test(key)) return "string" === typeof value; - if (RegExp(/((.*)_postfix)$/).test(key)) + if ( + "string" === typeof key && + RegExp(/(.*)_postfix$/).test(key) + ) return "string" === typeof value; if ( + "string" === typeof key && RegExp( - /^(value_between_[+-]?\d+(?:\.\d+)?(?:[eE][+-]?\d+)?_and_[+-]?\d+(?:\.\d+)?(?:[eE][+-]?\d+)?)$/, + /^value_between_[+-]?\d+(?:\.\d+)?(?:[eE][+-]?\d+)?_and_[+-]?\d+(?:\.\d+)?(?:[eE][+-]?\d+)?$/, ).test(key) ) return "number" === typeof value && Number.isFinite(value); diff --git a/test/generated/output/misc.createPrune/test_misc_createPrune_DynamicTag.ts b/test/generated/output/misc.createPrune/test_misc_createPrune_DynamicTag.ts new file mode 100644 index 0000000000..a2dfcad1b1 --- /dev/null +++ b/test/generated/output/misc.createPrune/test_misc_createPrune_DynamicTag.ts @@ -0,0 +1,26 @@ +import typia from "../../../../src"; +import { _test_misc_prune } from "../../../internal/_test_misc_prune"; +import { DynamicTag } from "../../../structures/DynamicTag"; + +export const test_misc_createPrune_DynamicTag = _test_misc_prune( + "DynamicTag", +)(DynamicTag)((input: DynamicTag): void => { + const $po0 = (input: any): any => { + Object.entries(input).forEach(([key, value]: any) => { + if (undefined === value) return; + if (RegExp(/^[+-]?\d+(?:\.\d+)?(?:[eE][+-]?\d+)?$/).test(key)) { + } + if (RegExp(/(.*)/).test(key)) { + } + }); + for (const key of Object.keys(input)) { + if ( + RegExp(/^[+-]?\d+(?:\.\d+)?(?:[eE][+-]?\d+)?$/).test(key) || + RegExp(/(.*)/).test(key) + ) + continue; + delete input[key]; + } + }; + if ("object" === typeof input && null !== input) $po0(input); +}); diff --git a/test/generated/output/misc.createValidateClone/test_misc_createValidateClone_DynamicComposite.ts b/test/generated/output/misc.createValidateClone/test_misc_createValidateClone_DynamicComposite.ts index 09b80a779e..2b1478b275 100644 --- a/test/generated/output/misc.createValidateClone/test_misc_createValidateClone_DynamicComposite.ts +++ b/test/generated/output/misc.createValidateClone/test_misc_createValidateClone_DynamicComposite.ts @@ -18,21 +18,27 @@ export const test_misc_createValidateClone_DynamicComposite = const value = input[key]; if (undefined === value) return true; if ( - RegExp( - /^[+-]?\d+(?:\.\d+)?(?:[eE][+-]?\d+)?$/, - ).test(key) + "number" === typeof Number(key) && + Number.isFinite(Number(key)) ) return ( "number" === typeof value && Number.isFinite(value) ); - if (RegExp(/^(prefix_(.*))/).test(key)) + if ( + "string" === typeof key && + RegExp(/^prefix_(.*)/).test(key) + ) return "string" === typeof value; - if (RegExp(/((.*)_postfix)$/).test(key)) + if ( + "string" === typeof key && + RegExp(/(.*)_postfix$/).test(key) + ) return "string" === typeof value; if ( + "string" === typeof key && RegExp( - /^(value_[+-]?\d+(?:\.\d+)?(?:[eE][+-]?\d+)?)$/, + /^value_[+-]?\d+(?:\.\d+)?(?:[eE][+-]?\d+)?$/, ).test(key) ) return ( @@ -42,8 +48,9 @@ export const test_misc_createValidateClone_DynamicComposite = "boolean" === typeof value ); if ( + "string" === typeof key && RegExp( - /^(between_(.*)_and_[+-]?\d+(?:\.\d+)?(?:[eE][+-]?\d+)?)$/, + /^between_(.*)_and_[+-]?\d+(?:\.\d+)?(?:[eE][+-]?\d+)?$/, ).test(key) ) return "boolean" === typeof value; @@ -93,9 +100,8 @@ export const test_misc_createValidateClone_DynamicComposite = const value = input[key]; if (undefined === value) return true; if ( - RegExp( - /^[+-]?\d+(?:\.\d+)?(?:[eE][+-]?\d+)?$/, - ).test(key) + "number" === typeof Number(key) && + Number.isFinite(Number(key)) ) return ( ("number" === typeof value && @@ -106,7 +112,10 @@ export const test_misc_createValidateClone_DynamicComposite = value: value, }) ); - if (RegExp(/^(prefix_(.*))/).test(key)) + if ( + "string" === typeof key && + RegExp(/^prefix_(.*)/).test(key) + ) return ( "string" === typeof value || $report(_exceptionable, { @@ -115,7 +124,10 @@ export const test_misc_createValidateClone_DynamicComposite = value: value, }) ); - if (RegExp(/((.*)_postfix)$/).test(key)) + if ( + "string" === typeof key && + RegExp(/(.*)_postfix$/).test(key) + ) return ( "string" === typeof value || $report(_exceptionable, { @@ -125,8 +137,9 @@ export const test_misc_createValidateClone_DynamicComposite = }) ); if ( + "string" === typeof key && RegExp( - /^(value_[+-]?\d+(?:\.\d+)?(?:[eE][+-]?\d+)?)$/, + /^value_[+-]?\d+(?:\.\d+)?(?:[eE][+-]?\d+)?$/, ).test(key) ) return ( @@ -142,8 +155,9 @@ export const test_misc_createValidateClone_DynamicComposite = }) ); if ( + "string" === typeof key && RegExp( - /^(between_(.*)_and_[+-]?\d+(?:\.\d+)?(?:[eE][+-]?\d+)?)$/, + /^between_(.*)_and_[+-]?\d+(?:\.\d+)?(?:[eE][+-]?\d+)?$/, ).test(key) ) return ( diff --git a/test/generated/output/misc.createValidateClone/test_misc_createValidateClone_DynamicNever.ts b/test/generated/output/misc.createValidateClone/test_misc_createValidateClone_DynamicNever.ts index e215f47b82..92831d435e 100644 --- a/test/generated/output/misc.createValidateClone/test_misc_createValidateClone_DynamicNever.ts +++ b/test/generated/output/misc.createValidateClone/test_misc_createValidateClone_DynamicNever.ts @@ -12,7 +12,7 @@ export const test_misc_createValidateClone_DynamicNever = Object.keys(input).every((key: any) => { const value = input[key]; if (undefined === value) return true; - if (RegExp(/(.*)/).test(key)) + if (true) return null !== value && undefined === value; return true; }); @@ -46,7 +46,7 @@ export const test_misc_createValidateClone_DynamicNever = const value = input[key]; if (undefined === value) return true; - if (RegExp(/(.*)/).test(key)) + if (true) return ( (null !== value || $report( diff --git a/test/generated/output/misc.createValidateClone/test_misc_createValidateClone_DynamicTemplate.ts b/test/generated/output/misc.createValidateClone/test_misc_createValidateClone_DynamicTemplate.ts index 90a2bc24bf..5199dea365 100644 --- a/test/generated/output/misc.createValidateClone/test_misc_createValidateClone_DynamicTemplate.ts +++ b/test/generated/output/misc.createValidateClone/test_misc_createValidateClone_DynamicTemplate.ts @@ -13,13 +13,20 @@ export const test_misc_createValidateClone_DynamicTemplate = Object.keys(input).every((key: any) => { const value = input[key]; if (undefined === value) return true; - if (RegExp(/^(prefix_(.*))/).test(key)) + if ( + "string" === typeof key && + RegExp(/^prefix_(.*)/).test(key) + ) return "string" === typeof value; - if (RegExp(/((.*)_postfix)$/).test(key)) + if ( + "string" === typeof key && + RegExp(/(.*)_postfix$/).test(key) + ) return "string" === typeof value; if ( + "string" === typeof key && RegExp( - /^(value_[+-]?\d+(?:\.\d+)?(?:[eE][+-]?\d+)?)$/, + /^value_[+-]?\d+(?:\.\d+)?(?:[eE][+-]?\d+)?$/, ).test(key) ) return ( @@ -27,8 +34,9 @@ export const test_misc_createValidateClone_DynamicTemplate = Number.isFinite(value) ); if ( + "string" === typeof key && RegExp( - /^(between_(.*)_and_[+-]?\d+(?:\.\d+)?(?:[eE][+-]?\d+)?)$/, + /^between_(.*)_and_[+-]?\d+(?:\.\d+)?(?:[eE][+-]?\d+)?$/, ).test(key) ) return "boolean" === typeof value; @@ -62,7 +70,10 @@ export const test_misc_createValidateClone_DynamicTemplate = .map((key: any) => { const value = input[key]; if (undefined === value) return true; - if (RegExp(/^(prefix_(.*))/).test(key)) + if ( + "string" === typeof key && + RegExp(/^prefix_(.*)/).test(key) + ) return ( "string" === typeof value || $report(_exceptionable, { @@ -71,7 +82,10 @@ export const test_misc_createValidateClone_DynamicTemplate = value: value, }) ); - if (RegExp(/((.*)_postfix)$/).test(key)) + if ( + "string" === typeof key && + RegExp(/(.*)_postfix$/).test(key) + ) return ( "string" === typeof value || $report(_exceptionable, { @@ -81,8 +95,9 @@ export const test_misc_createValidateClone_DynamicTemplate = }) ); if ( + "string" === typeof key && RegExp( - /^(value_[+-]?\d+(?:\.\d+)?(?:[eE][+-]?\d+)?)$/, + /^value_[+-]?\d+(?:\.\d+)?(?:[eE][+-]?\d+)?$/, ).test(key) ) return ( @@ -95,8 +110,9 @@ export const test_misc_createValidateClone_DynamicTemplate = }) ); if ( + "string" === typeof key && RegExp( - /^(between_(.*)_and_[+-]?\d+(?:\.\d+)?(?:[eE][+-]?\d+)?)$/, + /^between_(.*)_and_[+-]?\d+(?:\.\d+)?(?:[eE][+-]?\d+)?$/, ).test(key) ) return ( diff --git a/test/generated/output/misc.createValidateClone/test_misc_createValidateClone_DynamicTree.ts b/test/generated/output/misc.createValidateClone/test_misc_createValidateClone_DynamicTree.ts index fa838f9aba..edd0164b91 100644 --- a/test/generated/output/misc.createValidateClone/test_misc_createValidateClone_DynamicTree.ts +++ b/test/generated/output/misc.createValidateClone/test_misc_createValidateClone_DynamicTree.ts @@ -20,7 +20,7 @@ export const test_misc_createValidateClone_DynamicTree = Object.keys(input).every((key: any) => { const value = input[key]; if (undefined === value) return true; - if (RegExp(/(.*)/).test(key)) + if (true) return ( "object" === typeof value && null !== value && @@ -95,7 +95,7 @@ export const test_misc_createValidateClone_DynamicTree = const value = input[key]; if (undefined === value) return true; - if (RegExp(/(.*)/).test(key)) + if (true) return ( ((("object" === typeof value && @@ -163,7 +163,7 @@ export const test_misc_createValidateClone_DynamicTree = Object.keys(input).every((key: any) => { const value = input[key]; if (undefined === value) return true; - if (RegExp(/(.*)/).test(key)) + if (true) return ( "object" === typeof value && null !== value && diff --git a/test/generated/output/misc.createValidateClone/test_misc_createValidateClone_DynamicUndefined.ts b/test/generated/output/misc.createValidateClone/test_misc_createValidateClone_DynamicUndefined.ts index fb89290b9d..6ecd6bae80 100644 --- a/test/generated/output/misc.createValidateClone/test_misc_createValidateClone_DynamicUndefined.ts +++ b/test/generated/output/misc.createValidateClone/test_misc_createValidateClone_DynamicUndefined.ts @@ -13,8 +13,7 @@ export const test_misc_createValidateClone_DynamicUndefined = Object.keys(input).every((key: any) => { const value = input[key]; if (undefined === value) return true; - if (RegExp(/(.*)/).test(key)) - return null !== value && undefined === value; + if (true) return null !== value && undefined === value; return true; }); return ( @@ -45,7 +44,7 @@ export const test_misc_createValidateClone_DynamicUndefined = .map((key: any) => { const value = input[key]; if (undefined === value) return true; - if (RegExp(/(.*)/).test(key)) + if (true) return ( (null !== value || $report(_exceptionable, { diff --git a/test/generated/output/misc.createValidateClone/test_misc_createValidateClone_DynamicUnion.ts b/test/generated/output/misc.createValidateClone/test_misc_createValidateClone_DynamicUnion.ts index aece41088d..9fd3b76dc0 100644 --- a/test/generated/output/misc.createValidateClone/test_misc_createValidateClone_DynamicUnion.ts +++ b/test/generated/output/misc.createValidateClone/test_misc_createValidateClone_DynamicUnion.ts @@ -13,18 +13,24 @@ export const test_misc_createValidateClone_DynamicUnion = const value = input[key]; if (undefined === value) return true; if ( - RegExp( - /^[+-]?\d+(?:\.\d+)?(?:[eE][+-]?\d+)?$/, - ).test(key) + "number" === typeof Number(key) && + Number.isFinite(Number(key)) ) return "string" === typeof value; - if (RegExp(/^(prefix_(.*))/).test(key)) + if ( + "string" === typeof key && + RegExp(/^prefix_(.*)/).test(key) + ) return "string" === typeof value; - if (RegExp(/((.*)_postfix)$/).test(key)) + if ( + "string" === typeof key && + RegExp(/(.*)_postfix$/).test(key) + ) return "string" === typeof value; if ( + "string" === typeof key && RegExp( - /^(value_between_[+-]?\d+(?:\.\d+)?(?:[eE][+-]?\d+)?_and_[+-]?\d+(?:\.\d+)?(?:[eE][+-]?\d+)?)$/, + /^value_between_[+-]?\d+(?:\.\d+)?(?:[eE][+-]?\d+)?_and_[+-]?\d+(?:\.\d+)?(?:[eE][+-]?\d+)?$/, ).test(key) ) return ( @@ -64,9 +70,9 @@ export const test_misc_createValidateClone_DynamicUnion = if (undefined === value) return true; if ( - RegExp( - /^[+-]?\d+(?:\.\d+)?(?:[eE][+-]?\d+)?$/, - ).test(key) + "number" === + typeof Number(key) && + Number.isFinite(Number(key)) ) return ( "string" === typeof value || @@ -78,9 +84,8 @@ export const test_misc_createValidateClone_DynamicUnion = }) ); if ( - RegExp(/^(prefix_(.*))/).test( - key, - ) + "string" === typeof key && + RegExp(/^prefix_(.*)/).test(key) ) return ( "string" === typeof value || @@ -92,7 +97,8 @@ export const test_misc_createValidateClone_DynamicUnion = }) ); if ( - RegExp(/((.*)_postfix)$/).test( + "string" === typeof key && + RegExp(/(.*)_postfix$/).test( key, ) ) @@ -106,8 +112,9 @@ export const test_misc_createValidateClone_DynamicUnion = }) ); if ( + "string" === typeof key && RegExp( - /^(value_between_[+-]?\d+(?:\.\d+)?(?:[eE][+-]?\d+)?_and_[+-]?\d+(?:\.\d+)?(?:[eE][+-]?\d+)?)$/, + /^value_between_[+-]?\d+(?:\.\d+)?(?:[eE][+-]?\d+)?_and_[+-]?\d+(?:\.\d+)?(?:[eE][+-]?\d+)?$/, ).test(key) ) return ( diff --git a/test/generated/output/misc.createValidateClone/test_misc_createValidateClone_ObjectDynamic.ts b/test/generated/output/misc.createValidateClone/test_misc_createValidateClone_ObjectDynamic.ts index 7067c51209..0322794013 100644 --- a/test/generated/output/misc.createValidateClone/test_misc_createValidateClone_ObjectDynamic.ts +++ b/test/generated/output/misc.createValidateClone/test_misc_createValidateClone_ObjectDynamic.ts @@ -12,7 +12,7 @@ export const test_misc_createValidateClone_ObjectDynamic = Object.keys(input).every((key: any) => { const value = input[key]; if (undefined === value) return true; - if (RegExp(/(.*)/).test(key)) + if (true) return ( "string" === typeof value || ("number" === typeof value && @@ -51,7 +51,7 @@ export const test_misc_createValidateClone_ObjectDynamic = const value = input[key]; if (undefined === value) return true; - if (RegExp(/(.*)/).test(key)) + if (true) return ( "string" === typeof value || ("number" === diff --git a/test/generated/output/misc.createValidateClone/test_misc_createValidateClone_UltimateUnion.ts b/test/generated/output/misc.createValidateClone/test_misc_createValidateClone_UltimateUnion.ts index a9ae830885..f7d4ba01f2 100644 --- a/test/generated/output/misc.createValidateClone/test_misc_createValidateClone_UltimateUnion.ts +++ b/test/generated/output/misc.createValidateClone/test_misc_createValidateClone_UltimateUnion.ts @@ -523,7 +523,7 @@ export const test_misc_createValidateClone_UltimateUnion = Object.keys(input).every((key: any) => { const value = input[key]; if (undefined === value) return true; - if (RegExp(/(.*)/).test(key)) + if (true) return ( "object" === typeof value && null !== value && @@ -592,7 +592,7 @@ export const test_misc_createValidateClone_UltimateUnion = Object.keys(input).every((key: any) => { const value = input[key]; if (undefined === value) return true; - if (RegExp(/(.*)/).test(key)) + if (true) return ( "object" === typeof value && null !== value && @@ -3792,7 +3792,7 @@ export const test_misc_createValidateClone_UltimateUnion = const value = input[key]; if (undefined === value) return true; - if (RegExp(/(.*)/).test(key)) + if (true) return ( ((("object" === typeof value && @@ -4117,7 +4117,7 @@ export const test_misc_createValidateClone_UltimateUnion = const value = input[key]; if (undefined === value) return true; - if (RegExp(/(.*)/).test(key)) + if (true) return ( ((("object" === typeof value && @@ -7397,7 +7397,7 @@ export const test_misc_createValidateClone_UltimateUnion = Object.keys(input).every((key: any) => { const value = input[key]; if (undefined === value) return true; - if (RegExp(/(.*)/).test(key)) + if (true) return ( "object" === typeof value && null !== value && @@ -7464,7 +7464,7 @@ export const test_misc_createValidateClone_UltimateUnion = Object.keys(input).every((key: any) => { const value = input[key]; if (undefined === value) return true; - if (RegExp(/(.*)/).test(key)) + if (true) return ( "object" === typeof value && null !== value && diff --git a/test/generated/output/misc.createValidatePrune/test_misc_createValidatePrune_DynamicComposite.ts b/test/generated/output/misc.createValidatePrune/test_misc_createValidatePrune_DynamicComposite.ts index 807398f750..ed7d6154e1 100644 --- a/test/generated/output/misc.createValidatePrune/test_misc_createValidatePrune_DynamicComposite.ts +++ b/test/generated/output/misc.createValidatePrune/test_misc_createValidatePrune_DynamicComposite.ts @@ -18,21 +18,27 @@ export const test_misc_createValidatePrune_DynamicComposite = const value = input[key]; if (undefined === value) return true; if ( - RegExp( - /^[+-]?\d+(?:\.\d+)?(?:[eE][+-]?\d+)?$/, - ).test(key) + "number" === typeof Number(key) && + Number.isFinite(Number(key)) ) return ( "number" === typeof value && Number.isFinite(value) ); - if (RegExp(/^(prefix_(.*))/).test(key)) + if ( + "string" === typeof key && + RegExp(/^prefix_(.*)/).test(key) + ) return "string" === typeof value; - if (RegExp(/((.*)_postfix)$/).test(key)) + if ( + "string" === typeof key && + RegExp(/(.*)_postfix$/).test(key) + ) return "string" === typeof value; if ( + "string" === typeof key && RegExp( - /^(value_[+-]?\d+(?:\.\d+)?(?:[eE][+-]?\d+)?)$/, + /^value_[+-]?\d+(?:\.\d+)?(?:[eE][+-]?\d+)?$/, ).test(key) ) return ( @@ -42,8 +48,9 @@ export const test_misc_createValidatePrune_DynamicComposite = "boolean" === typeof value ); if ( + "string" === typeof key && RegExp( - /^(between_(.*)_and_[+-]?\d+(?:\.\d+)?(?:[eE][+-]?\d+)?)$/, + /^between_(.*)_and_[+-]?\d+(?:\.\d+)?(?:[eE][+-]?\d+)?$/, ).test(key) ) return "boolean" === typeof value; @@ -93,9 +100,8 @@ export const test_misc_createValidatePrune_DynamicComposite = const value = input[key]; if (undefined === value) return true; if ( - RegExp( - /^[+-]?\d+(?:\.\d+)?(?:[eE][+-]?\d+)?$/, - ).test(key) + "number" === typeof Number(key) && + Number.isFinite(Number(key)) ) return ( ("number" === typeof value && @@ -106,7 +112,10 @@ export const test_misc_createValidatePrune_DynamicComposite = value: value, }) ); - if (RegExp(/^(prefix_(.*))/).test(key)) + if ( + "string" === typeof key && + RegExp(/^prefix_(.*)/).test(key) + ) return ( "string" === typeof value || $report(_exceptionable, { @@ -115,7 +124,10 @@ export const test_misc_createValidatePrune_DynamicComposite = value: value, }) ); - if (RegExp(/((.*)_postfix)$/).test(key)) + if ( + "string" === typeof key && + RegExp(/(.*)_postfix$/).test(key) + ) return ( "string" === typeof value || $report(_exceptionable, { @@ -125,8 +137,9 @@ export const test_misc_createValidatePrune_DynamicComposite = }) ); if ( + "string" === typeof key && RegExp( - /^(value_[+-]?\d+(?:\.\d+)?(?:[eE][+-]?\d+)?)$/, + /^value_[+-]?\d+(?:\.\d+)?(?:[eE][+-]?\d+)?$/, ).test(key) ) return ( @@ -142,8 +155,9 @@ export const test_misc_createValidatePrune_DynamicComposite = }) ); if ( + "string" === typeof key && RegExp( - /^(between_(.*)_and_[+-]?\d+(?:\.\d+)?(?:[eE][+-]?\d+)?)$/, + /^between_(.*)_and_[+-]?\d+(?:\.\d+)?(?:[eE][+-]?\d+)?$/, ).test(key) ) return ( diff --git a/test/generated/output/misc.createValidatePrune/test_misc_createValidatePrune_DynamicTag.ts b/test/generated/output/misc.createValidatePrune/test_misc_createValidatePrune_DynamicTag.ts new file mode 100644 index 0000000000..9f397ead28 --- /dev/null +++ b/test/generated/output/misc.createValidatePrune/test_misc_createValidatePrune_DynamicTag.ts @@ -0,0 +1,191 @@ +import typia from "../../../../src"; +import { _test_misc_validatePrune } from "../../../internal/_test_misc_validatePrune"; +import { DynamicTag } from "../../../structures/DynamicTag"; + +export const test_misc_createValidatePrune_DynamicTag = + _test_misc_validatePrune("DynamicTag")(DynamicTag)( + (input: any): typia.IValidation => { + const validate = (input: any): typia.IValidation => { + const errors = [] as any[]; + const __is = (input: any): input is DynamicTag => { + const $io0 = (input: any): boolean => + Object.keys(input).every((key: any) => { + const value = input[key]; + if (undefined === value) return true; + if ( + "number" === typeof Number(key) && + 0 <= Number(key) && + Number(key) < 10 + ) + return ( + "bigint" === typeof value && + BigInt(0) <= value + ); + if ( + "string" === typeof key && + /^(?:[0-9a-f]{8}-[0-9a-f]{4}-[1-5][0-9a-f]{3}-[89ab][0-9a-f]{3}-[0-9a-f]{12}|00000000-0000-0000-0000-000000000000)$/i.test( + key, + ) + ) + return ( + "string" === typeof value && + /^(([^<>()[\]\.,;:\s@\"]+(\.[^<>()[\]\.,;:\s@\"]+)*)|(\".+\"))@(([^<>()[\]\.,;:\s@\"]+\.)+[^<>()[\]\.,;:\s@\"]{2,})$/i.test( + value, + ) + ); + return true; + }); + return ( + "object" === typeof input && + null !== input && + false === Array.isArray(input) && + $io0(input) + ); + }; + if (false === __is(input)) { + const $report = ( + typia.misc.createValidatePrune as any + ).report(errors); + (( + input: any, + _path: string, + _exceptionable: boolean = true, + ): input is DynamicTag => { + const $join = (typia.misc.createValidatePrune as any) + .join; + const $vo0 = ( + input: any, + _path: string, + _exceptionable: boolean = true, + ): boolean => + [ + false === _exceptionable || + Object.keys(input) + .map((key: any) => { + const value = input[key]; + if (undefined === value) + return true; + if ( + "number" === + typeof Number(key) && + 0 <= Number(key) && + Number(key) < 10 + ) + return ( + ("bigint" === + typeof value && + (BigInt(0) <= value || + $report( + _exceptionable, + { + path: + _path + + $join( + key, + ), + expected: + 'bigint & Type<"uint64">', + value: value, + }, + ))) || + $report(_exceptionable, { + path: + _path + $join(key), + expected: + '(bigint & Type<"uint64">)', + value: value, + }) + ); + if ( + "string" === typeof key && + /^(?:[0-9a-f]{8}-[0-9a-f]{4}-[1-5][0-9a-f]{3}-[89ab][0-9a-f]{3}-[0-9a-f]{12}|00000000-0000-0000-0000-000000000000)$/i.test( + key, + ) + ) + return ( + ("string" === + typeof value && + (/^(([^<>()[\]\.,;:\s@\"]+(\.[^<>()[\]\.,;:\s@\"]+)*)|(\".+\"))@(([^<>()[\]\.,;:\s@\"]+\.)+[^<>()[\]\.,;:\s@\"]{2,})$/i.test( + value, + ) || + $report( + _exceptionable, + { + path: + _path + + $join( + key, + ), + expected: + 'string & Format<"email">', + value: value, + }, + ))) || + $report(_exceptionable, { + path: + _path + $join(key), + expected: + '(string & Format<"email">)', + value: value, + }) + ); + return true; + }) + .every((flag: boolean) => flag), + ].every((flag: boolean) => flag); + return ( + ((("object" === typeof input && + null !== input && + false === Array.isArray(input)) || + $report(true, { + path: _path + "", + expected: "DynamicTag", + value: input, + })) && + $vo0(input, _path + "", true)) || + $report(true, { + path: _path + "", + expected: "DynamicTag", + value: input, + }) + ); + })(input, "$input", true); + } + const success = 0 === errors.length; + return { + success, + errors, + data: success ? input : undefined, + } as any; + }; + const prune = (input: DynamicTag): void => { + const $po0 = (input: any): any => { + Object.entries(input).forEach(([key, value]: any) => { + if (undefined === value) return; + if ( + RegExp( + /^[+-]?\d+(?:\.\d+)?(?:[eE][+-]?\d+)?$/, + ).test(key) + ) { + } + if (RegExp(/(.*)/).test(key)) { + } + }); + for (const key of Object.keys(input)) { + if ( + RegExp( + /^[+-]?\d+(?:\.\d+)?(?:[eE][+-]?\d+)?$/, + ).test(key) || + RegExp(/(.*)/).test(key) + ) + continue; + delete input[key]; + } + }; + if ("object" === typeof input && null !== input) $po0(input); + }; + const output = validate(input); + if (output.success) prune(input); + return output; + }, + ); diff --git a/test/generated/output/misc.createValidatePrune/test_misc_createValidatePrune_DynamicTemplate.ts b/test/generated/output/misc.createValidatePrune/test_misc_createValidatePrune_DynamicTemplate.ts index bc73dbc215..3459231c09 100644 --- a/test/generated/output/misc.createValidatePrune/test_misc_createValidatePrune_DynamicTemplate.ts +++ b/test/generated/output/misc.createValidatePrune/test_misc_createValidatePrune_DynamicTemplate.ts @@ -13,13 +13,20 @@ export const test_misc_createValidatePrune_DynamicTemplate = Object.keys(input).every((key: any) => { const value = input[key]; if (undefined === value) return true; - if (RegExp(/^(prefix_(.*))/).test(key)) + if ( + "string" === typeof key && + RegExp(/^prefix_(.*)/).test(key) + ) return "string" === typeof value; - if (RegExp(/((.*)_postfix)$/).test(key)) + if ( + "string" === typeof key && + RegExp(/(.*)_postfix$/).test(key) + ) return "string" === typeof value; if ( + "string" === typeof key && RegExp( - /^(value_[+-]?\d+(?:\.\d+)?(?:[eE][+-]?\d+)?)$/, + /^value_[+-]?\d+(?:\.\d+)?(?:[eE][+-]?\d+)?$/, ).test(key) ) return ( @@ -27,8 +34,9 @@ export const test_misc_createValidatePrune_DynamicTemplate = Number.isFinite(value) ); if ( + "string" === typeof key && RegExp( - /^(between_(.*)_and_[+-]?\d+(?:\.\d+)?(?:[eE][+-]?\d+)?)$/, + /^between_(.*)_and_[+-]?\d+(?:\.\d+)?(?:[eE][+-]?\d+)?$/, ).test(key) ) return "boolean" === typeof value; @@ -62,7 +70,10 @@ export const test_misc_createValidatePrune_DynamicTemplate = .map((key: any) => { const value = input[key]; if (undefined === value) return true; - if (RegExp(/^(prefix_(.*))/).test(key)) + if ( + "string" === typeof key && + RegExp(/^prefix_(.*)/).test(key) + ) return ( "string" === typeof value || $report(_exceptionable, { @@ -71,7 +82,10 @@ export const test_misc_createValidatePrune_DynamicTemplate = value: value, }) ); - if (RegExp(/((.*)_postfix)$/).test(key)) + if ( + "string" === typeof key && + RegExp(/(.*)_postfix$/).test(key) + ) return ( "string" === typeof value || $report(_exceptionable, { @@ -81,8 +95,9 @@ export const test_misc_createValidatePrune_DynamicTemplate = }) ); if ( + "string" === typeof key && RegExp( - /^(value_[+-]?\d+(?:\.\d+)?(?:[eE][+-]?\d+)?)$/, + /^value_[+-]?\d+(?:\.\d+)?(?:[eE][+-]?\d+)?$/, ).test(key) ) return ( @@ -95,8 +110,9 @@ export const test_misc_createValidatePrune_DynamicTemplate = }) ); if ( + "string" === typeof key && RegExp( - /^(between_(.*)_and_[+-]?\d+(?:\.\d+)?(?:[eE][+-]?\d+)?)$/, + /^between_(.*)_and_[+-]?\d+(?:\.\d+)?(?:[eE][+-]?\d+)?$/, ).test(key) ) return ( diff --git a/test/generated/output/misc.createValidatePrune/test_misc_createValidatePrune_DynamicUnion.ts b/test/generated/output/misc.createValidatePrune/test_misc_createValidatePrune_DynamicUnion.ts index 9e7b73d6f8..1f1f5fed47 100644 --- a/test/generated/output/misc.createValidatePrune/test_misc_createValidatePrune_DynamicUnion.ts +++ b/test/generated/output/misc.createValidatePrune/test_misc_createValidatePrune_DynamicUnion.ts @@ -13,18 +13,24 @@ export const test_misc_createValidatePrune_DynamicUnion = const value = input[key]; if (undefined === value) return true; if ( - RegExp( - /^[+-]?\d+(?:\.\d+)?(?:[eE][+-]?\d+)?$/, - ).test(key) + "number" === typeof Number(key) && + Number.isFinite(Number(key)) ) return "string" === typeof value; - if (RegExp(/^(prefix_(.*))/).test(key)) + if ( + "string" === typeof key && + RegExp(/^prefix_(.*)/).test(key) + ) return "string" === typeof value; - if (RegExp(/((.*)_postfix)$/).test(key)) + if ( + "string" === typeof key && + RegExp(/(.*)_postfix$/).test(key) + ) return "string" === typeof value; if ( + "string" === typeof key && RegExp( - /^(value_between_[+-]?\d+(?:\.\d+)?(?:[eE][+-]?\d+)?_and_[+-]?\d+(?:\.\d+)?(?:[eE][+-]?\d+)?)$/, + /^value_between_[+-]?\d+(?:\.\d+)?(?:[eE][+-]?\d+)?_and_[+-]?\d+(?:\.\d+)?(?:[eE][+-]?\d+)?$/, ).test(key) ) return ( @@ -64,9 +70,9 @@ export const test_misc_createValidatePrune_DynamicUnion = if (undefined === value) return true; if ( - RegExp( - /^[+-]?\d+(?:\.\d+)?(?:[eE][+-]?\d+)?$/, - ).test(key) + "number" === + typeof Number(key) && + Number.isFinite(Number(key)) ) return ( "string" === typeof value || @@ -78,9 +84,8 @@ export const test_misc_createValidatePrune_DynamicUnion = }) ); if ( - RegExp(/^(prefix_(.*))/).test( - key, - ) + "string" === typeof key && + RegExp(/^prefix_(.*)/).test(key) ) return ( "string" === typeof value || @@ -92,7 +97,8 @@ export const test_misc_createValidatePrune_DynamicUnion = }) ); if ( - RegExp(/((.*)_postfix)$/).test( + "string" === typeof key && + RegExp(/(.*)_postfix$/).test( key, ) ) @@ -106,8 +112,9 @@ export const test_misc_createValidatePrune_DynamicUnion = }) ); if ( + "string" === typeof key && RegExp( - /^(value_between_[+-]?\d+(?:\.\d+)?(?:[eE][+-]?\d+)?_and_[+-]?\d+(?:\.\d+)?(?:[eE][+-]?\d+)?)$/, + /^value_between_[+-]?\d+(?:\.\d+)?(?:[eE][+-]?\d+)?_and_[+-]?\d+(?:\.\d+)?(?:[eE][+-]?\d+)?$/, ).test(key) ) return ( diff --git a/test/generated/output/misc.isClone/test_misc_isClone_DynamicArray.ts b/test/generated/output/misc.isClone/test_misc_isClone_DynamicArray.ts index 70638d6fcb..3b8aa2b992 100644 --- a/test/generated/output/misc.isClone/test_misc_isClone_DynamicArray.ts +++ b/test/generated/output/misc.isClone/test_misc_isClone_DynamicArray.ts @@ -16,7 +16,7 @@ export const test_misc_isClone_DynamicArray = _test_misc_isClone( Object.keys(input).every((key: any) => { const value = input[key]; if (undefined === value) return true; - if (RegExp(/(.*)/).test(key)) + if (true) return ( Array.isArray(value) && value.every((elem: any) => "string" === typeof elem) @@ -30,7 +30,7 @@ export const test_misc_isClone_DynamicArray = _test_misc_isClone( Object.keys(input).every((key: any) => { const value = input[key]; if (undefined === value) return true; - if (RegExp(/(.*)/).test(key)) + if (true) return ( Array.isArray(value) && value.every((elem: any) => "string" === typeof elem) diff --git a/test/generated/output/misc.isClone/test_misc_isClone_DynamicComposite.ts b/test/generated/output/misc.isClone/test_misc_isClone_DynamicComposite.ts index 20b4fe10e4..b833aaf49b 100644 --- a/test/generated/output/misc.isClone/test_misc_isClone_DynamicComposite.ts +++ b/test/generated/output/misc.isClone/test_misc_isClone_DynamicComposite.ts @@ -16,20 +16,26 @@ export const test_misc_isClone_DynamicComposite = _test_misc_isClone( const value = input[key]; if (undefined === value) return true; if ( - RegExp(/^[+-]?\d+(?:\.\d+)?(?:[eE][+-]?\d+)?$/).test( - key, - ) + "number" === typeof Number(key) && + Number.isFinite(Number(key)) ) return ( "number" === typeof value && Number.isFinite(value) ); - if (RegExp(/^(prefix_(.*))/).test(key)) + if ( + "string" === typeof key && + RegExp(/^prefix_(.*)/).test(key) + ) return "string" === typeof value; - if (RegExp(/((.*)_postfix)$/).test(key)) + if ( + "string" === typeof key && + RegExp(/(.*)_postfix$/).test(key) + ) return "string" === typeof value; if ( + "string" === typeof key && RegExp( - /^(value_[+-]?\d+(?:\.\d+)?(?:[eE][+-]?\d+)?)$/, + /^value_[+-]?\d+(?:\.\d+)?(?:[eE][+-]?\d+)?$/, ).test(key) ) return ( @@ -39,8 +45,9 @@ export const test_misc_isClone_DynamicComposite = _test_misc_isClone( "boolean" === typeof value ); if ( + "string" === typeof key && RegExp( - /^(between_(.*)_and_[+-]?\d+(?:\.\d+)?(?:[eE][+-]?\d+)?)$/, + /^between_(.*)_and_[+-]?\d+(?:\.\d+)?(?:[eE][+-]?\d+)?$/, ).test(key) ) return "boolean" === typeof value; diff --git a/test/generated/output/misc.isClone/test_misc_isClone_DynamicNever.ts b/test/generated/output/misc.isClone/test_misc_isClone_DynamicNever.ts index 106f56fa5f..aef84f9a36 100644 --- a/test/generated/output/misc.isClone/test_misc_isClone_DynamicNever.ts +++ b/test/generated/output/misc.isClone/test_misc_isClone_DynamicNever.ts @@ -11,8 +11,7 @@ export const test_misc_isClone_DynamicNever = _test_misc_isClone( Object.keys(input).every((key: any) => { const value = input[key]; if (undefined === value) return true; - if (RegExp(/(.*)/).test(key)) - return null !== value && undefined === value; + if (true) return null !== value && undefined === value; return true; }); return ( diff --git a/test/generated/output/misc.isClone/test_misc_isClone_DynamicSimple.ts b/test/generated/output/misc.isClone/test_misc_isClone_DynamicSimple.ts index 3fbd14253e..6bdd8eb3a3 100644 --- a/test/generated/output/misc.isClone/test_misc_isClone_DynamicSimple.ts +++ b/test/generated/output/misc.isClone/test_misc_isClone_DynamicSimple.ts @@ -16,7 +16,7 @@ export const test_misc_isClone_DynamicSimple = _test_misc_isClone( Object.keys(input).every((key: any) => { const value = input[key]; if (undefined === value) return true; - if (RegExp(/(.*)/).test(key)) + if (true) return ( "number" === typeof value && Number.isFinite(value) ); @@ -29,8 +29,7 @@ export const test_misc_isClone_DynamicSimple = _test_misc_isClone( Object.keys(input).every((key: any) => { const value = input[key]; if (undefined === value) return true; - if (RegExp(/(.*)/).test(key)) - return "number" === typeof value; + if (true) return "number" === typeof value; return true; }); const $co0 = (input: any): any => ({ diff --git a/test/generated/output/misc.isClone/test_misc_isClone_DynamicTemplate.ts b/test/generated/output/misc.isClone/test_misc_isClone_DynamicTemplate.ts index e0b1a50905..5023fc8876 100644 --- a/test/generated/output/misc.isClone/test_misc_isClone_DynamicTemplate.ts +++ b/test/generated/output/misc.isClone/test_misc_isClone_DynamicTemplate.ts @@ -11,21 +11,29 @@ export const test_misc_isClone_DynamicTemplate = _test_misc_isClone( Object.keys(input).every((key: any) => { const value = input[key]; if (undefined === value) return true; - if (RegExp(/^(prefix_(.*))/).test(key)) + if ( + "string" === typeof key && + RegExp(/^prefix_(.*)/).test(key) + ) return "string" === typeof value; - if (RegExp(/((.*)_postfix)$/).test(key)) + if ( + "string" === typeof key && + RegExp(/(.*)_postfix$/).test(key) + ) return "string" === typeof value; if ( + "string" === typeof key && RegExp( - /^(value_[+-]?\d+(?:\.\d+)?(?:[eE][+-]?\d+)?)$/, + /^value_[+-]?\d+(?:\.\d+)?(?:[eE][+-]?\d+)?$/, ).test(key) ) return ( "number" === typeof value && Number.isFinite(value) ); if ( + "string" === typeof key && RegExp( - /^(between_(.*)_and_[+-]?\d+(?:\.\d+)?(?:[eE][+-]?\d+)?)$/, + /^between_(.*)_and_[+-]?\d+(?:\.\d+)?(?:[eE][+-]?\d+)?$/, ).test(key) ) return "boolean" === typeof value; diff --git a/test/generated/output/misc.isClone/test_misc_isClone_DynamicTree.ts b/test/generated/output/misc.isClone/test_misc_isClone_DynamicTree.ts index 11adaa3406..7ffb3efa00 100644 --- a/test/generated/output/misc.isClone/test_misc_isClone_DynamicTree.ts +++ b/test/generated/output/misc.isClone/test_misc_isClone_DynamicTree.ts @@ -19,7 +19,7 @@ export const test_misc_isClone_DynamicTree = _test_misc_isClone( Object.keys(input).every((key: any) => { const value = input[key]; if (undefined === value) return true; - if (RegExp(/(.*)/).test(key)) + if (true) return ( "object" === typeof value && null !== value && @@ -41,7 +41,7 @@ export const test_misc_isClone_DynamicTree = _test_misc_isClone( Object.keys(input).every((key: any) => { const value = input[key]; if (undefined === value) return true; - if (RegExp(/(.*)/).test(key)) + if (true) return ( "object" === typeof value && null !== value && diff --git a/test/generated/output/misc.isClone/test_misc_isClone_DynamicUndefined.ts b/test/generated/output/misc.isClone/test_misc_isClone_DynamicUndefined.ts index 9d9867a44d..70c3b63ba9 100644 --- a/test/generated/output/misc.isClone/test_misc_isClone_DynamicUndefined.ts +++ b/test/generated/output/misc.isClone/test_misc_isClone_DynamicUndefined.ts @@ -11,8 +11,7 @@ export const test_misc_isClone_DynamicUndefined = _test_misc_isClone( Object.keys(input).every((key: any) => { const value = input[key]; if (undefined === value) return true; - if (RegExp(/(.*)/).test(key)) - return null !== value && undefined === value; + if (true) return null !== value && undefined === value; return true; }); return ( diff --git a/test/generated/output/misc.isClone/test_misc_isClone_DynamicUnion.ts b/test/generated/output/misc.isClone/test_misc_isClone_DynamicUnion.ts index c9d017b8e2..fb237460b1 100644 --- a/test/generated/output/misc.isClone/test_misc_isClone_DynamicUnion.ts +++ b/test/generated/output/misc.isClone/test_misc_isClone_DynamicUnion.ts @@ -12,18 +12,24 @@ export const test_misc_isClone_DynamicUnion = _test_misc_isClone( const value = input[key]; if (undefined === value) return true; if ( - RegExp(/^[+-]?\d+(?:\.\d+)?(?:[eE][+-]?\d+)?$/).test( - key, - ) + "number" === typeof Number(key) && + Number.isFinite(Number(key)) ) return "string" === typeof value; - if (RegExp(/^(prefix_(.*))/).test(key)) + if ( + "string" === typeof key && + RegExp(/^prefix_(.*)/).test(key) + ) return "string" === typeof value; - if (RegExp(/((.*)_postfix)$/).test(key)) + if ( + "string" === typeof key && + RegExp(/(.*)_postfix$/).test(key) + ) return "string" === typeof value; if ( + "string" === typeof key && RegExp( - /^(value_between_[+-]?\d+(?:\.\d+)?(?:[eE][+-]?\d+)?_and_[+-]?\d+(?:\.\d+)?(?:[eE][+-]?\d+)?)$/, + /^value_between_[+-]?\d+(?:\.\d+)?(?:[eE][+-]?\d+)?_and_[+-]?\d+(?:\.\d+)?(?:[eE][+-]?\d+)?$/, ).test(key) ) return ( diff --git a/test/generated/output/misc.isClone/test_misc_isClone_ObjectDynamic.ts b/test/generated/output/misc.isClone/test_misc_isClone_ObjectDynamic.ts index 32910e5c6b..2d73158f96 100644 --- a/test/generated/output/misc.isClone/test_misc_isClone_ObjectDynamic.ts +++ b/test/generated/output/misc.isClone/test_misc_isClone_ObjectDynamic.ts @@ -11,7 +11,7 @@ export const test_misc_isClone_ObjectDynamic = _test_misc_isClone( Object.keys(input).every((key: any) => { const value = input[key]; if (undefined === value) return true; - if (RegExp(/(.*)/).test(key)) + if (true) return ( "string" === typeof value || ("number" === typeof value && diff --git a/test/generated/output/misc.isClone/test_misc_isClone_UltimateUnion.ts b/test/generated/output/misc.isClone/test_misc_isClone_UltimateUnion.ts index 11e3e0887e..3fde3ca882 100644 --- a/test/generated/output/misc.isClone/test_misc_isClone_UltimateUnion.ts +++ b/test/generated/output/misc.isClone/test_misc_isClone_UltimateUnion.ts @@ -513,7 +513,7 @@ export const test_misc_isClone_UltimateUnion = _test_misc_isClone( Object.keys(input).every((key: any) => { const value = input[key]; if (undefined === value) return true; - if (RegExp(/(.*)/).test(key)) + if (true) return ( "object" === typeof value && null !== value && @@ -575,7 +575,7 @@ export const test_misc_isClone_UltimateUnion = _test_misc_isClone( Object.keys(input).every((key: any) => { const value = input[key]; if (undefined === value) return true; - if (RegExp(/(.*)/).test(key)) + if (true) return ( "object" === typeof value && null !== value && @@ -1639,7 +1639,7 @@ export const test_misc_isClone_UltimateUnion = _test_misc_isClone( Object.keys(input).every((key: any) => { const value = input[key]; if (undefined === value) return true; - if (RegExp(/(.*)/).test(key)) + if (true) return ( "object" === typeof value && null !== value && @@ -1701,7 +1701,7 @@ export const test_misc_isClone_UltimateUnion = _test_misc_isClone( Object.keys(input).every((key: any) => { const value = input[key]; if (undefined === value) return true; - if (RegExp(/(.*)/).test(key)) + if (true) return ( "object" === typeof value && null !== value && diff --git a/test/generated/output/misc.isPrune/test_misc_isPrune_DynamicComposite.ts b/test/generated/output/misc.isPrune/test_misc_isPrune_DynamicComposite.ts index d607a847bf..18d3189be6 100644 --- a/test/generated/output/misc.isPrune/test_misc_isPrune_DynamicComposite.ts +++ b/test/generated/output/misc.isPrune/test_misc_isPrune_DynamicComposite.ts @@ -16,20 +16,26 @@ export const test_misc_isPrune_DynamicComposite = _test_misc_isPrune( const value = input[key]; if (undefined === value) return true; if ( - RegExp(/^[+-]?\d+(?:\.\d+)?(?:[eE][+-]?\d+)?$/).test( - key, - ) + "number" === typeof Number(key) && + Number.isFinite(Number(key)) ) return ( "number" === typeof value && Number.isFinite(value) ); - if (RegExp(/^(prefix_(.*))/).test(key)) + if ( + "string" === typeof key && + RegExp(/^prefix_(.*)/).test(key) + ) return "string" === typeof value; - if (RegExp(/((.*)_postfix)$/).test(key)) + if ( + "string" === typeof key && + RegExp(/(.*)_postfix$/).test(key) + ) return "string" === typeof value; if ( + "string" === typeof key && RegExp( - /^(value_[+-]?\d+(?:\.\d+)?(?:[eE][+-]?\d+)?)$/, + /^value_[+-]?\d+(?:\.\d+)?(?:[eE][+-]?\d+)?$/, ).test(key) ) return ( @@ -39,8 +45,9 @@ export const test_misc_isPrune_DynamicComposite = _test_misc_isPrune( "boolean" === typeof value ); if ( + "string" === typeof key && RegExp( - /^(between_(.*)_and_[+-]?\d+(?:\.\d+)?(?:[eE][+-]?\d+)?)$/, + /^between_(.*)_and_[+-]?\d+(?:\.\d+)?(?:[eE][+-]?\d+)?$/, ).test(key) ) return "boolean" === typeof value; diff --git a/test/generated/output/misc.isPrune/test_misc_isPrune_DynamicTag.ts b/test/generated/output/misc.isPrune/test_misc_isPrune_DynamicTag.ts new file mode 100644 index 0000000000..2c5ac27fef --- /dev/null +++ b/test/generated/output/misc.isPrune/test_misc_isPrune_DynamicTag.ts @@ -0,0 +1,71 @@ +import typia from "../../../../src"; +import { _test_misc_isPrune } from "../../../internal/_test_misc_isPrune"; +import { DynamicTag } from "../../../structures/DynamicTag"; + +export const test_misc_isPrune_DynamicTag = _test_misc_isPrune( + "DynamicTag", +)(DynamicTag)((input) => + ((input: any): input is DynamicTag => { + const is = (input: any): input is DynamicTag => { + const $io0 = (input: any): boolean => + Object.keys(input).every((key: any) => { + const value = input[key]; + if (undefined === value) return true; + if ( + "number" === typeof Number(key) && + 0 <= Number(key) && + Number(key) < 10 + ) + return "bigint" === typeof value && BigInt(0) <= value; + if ( + "string" === typeof key && + /^(?:[0-9a-f]{8}-[0-9a-f]{4}-[1-5][0-9a-f]{3}-[89ab][0-9a-f]{3}-[0-9a-f]{12}|00000000-0000-0000-0000-000000000000)$/i.test( + key, + ) + ) + return ( + "string" === typeof value && + /^(([^<>()[\]\.,;:\s@\"]+(\.[^<>()[\]\.,;:\s@\"]+)*)|(\".+\"))@(([^<>()[\]\.,;:\s@\"]+\.)+[^<>()[\]\.,;:\s@\"]{2,})$/i.test( + value, + ) + ); + return true; + }); + return ( + "object" === typeof input && + null !== input && + false === Array.isArray(input) && + $io0(input) + ); + }; + const prune = (input: DynamicTag): void => { + const $po0 = (input: any): any => { + Object.entries(input).forEach(([key, value]: any) => { + if (undefined === value) return; + if ( + RegExp(/^[+-]?\d+(?:\.\d+)?(?:[eE][+-]?\d+)?$/).test( + key, + ) + ) { + } + if (RegExp(/(.*)/).test(key)) { + } + }); + for (const key of Object.keys(input)) { + if ( + RegExp(/^[+-]?\d+(?:\.\d+)?(?:[eE][+-]?\d+)?$/).test( + key, + ) || + RegExp(/(.*)/).test(key) + ) + continue; + delete input[key]; + } + }; + if ("object" === typeof input && null !== input) $po0(input); + }; + if (!is(input)) return false; + prune(input); + return true; + })(input), +); diff --git a/test/generated/output/misc.isPrune/test_misc_isPrune_DynamicTemplate.ts b/test/generated/output/misc.isPrune/test_misc_isPrune_DynamicTemplate.ts index af103382ee..3e0afd7c9c 100644 --- a/test/generated/output/misc.isPrune/test_misc_isPrune_DynamicTemplate.ts +++ b/test/generated/output/misc.isPrune/test_misc_isPrune_DynamicTemplate.ts @@ -11,21 +11,29 @@ export const test_misc_isPrune_DynamicTemplate = _test_misc_isPrune( Object.keys(input).every((key: any) => { const value = input[key]; if (undefined === value) return true; - if (RegExp(/^(prefix_(.*))/).test(key)) + if ( + "string" === typeof key && + RegExp(/^prefix_(.*)/).test(key) + ) return "string" === typeof value; - if (RegExp(/((.*)_postfix)$/).test(key)) + if ( + "string" === typeof key && + RegExp(/(.*)_postfix$/).test(key) + ) return "string" === typeof value; if ( + "string" === typeof key && RegExp( - /^(value_[+-]?\d+(?:\.\d+)?(?:[eE][+-]?\d+)?)$/, + /^value_[+-]?\d+(?:\.\d+)?(?:[eE][+-]?\d+)?$/, ).test(key) ) return ( "number" === typeof value && Number.isFinite(value) ); if ( + "string" === typeof key && RegExp( - /^(between_(.*)_and_[+-]?\d+(?:\.\d+)?(?:[eE][+-]?\d+)?)$/, + /^between_(.*)_and_[+-]?\d+(?:\.\d+)?(?:[eE][+-]?\d+)?$/, ).test(key) ) return "boolean" === typeof value; diff --git a/test/generated/output/misc.isPrune/test_misc_isPrune_DynamicUnion.ts b/test/generated/output/misc.isPrune/test_misc_isPrune_DynamicUnion.ts index 79228f1944..9716181b3e 100644 --- a/test/generated/output/misc.isPrune/test_misc_isPrune_DynamicUnion.ts +++ b/test/generated/output/misc.isPrune/test_misc_isPrune_DynamicUnion.ts @@ -12,18 +12,24 @@ export const test_misc_isPrune_DynamicUnion = _test_misc_isPrune( const value = input[key]; if (undefined === value) return true; if ( - RegExp(/^[+-]?\d+(?:\.\d+)?(?:[eE][+-]?\d+)?$/).test( - key, - ) + "number" === typeof Number(key) && + Number.isFinite(Number(key)) ) return "string" === typeof value; - if (RegExp(/^(prefix_(.*))/).test(key)) + if ( + "string" === typeof key && + RegExp(/^prefix_(.*)/).test(key) + ) return "string" === typeof value; - if (RegExp(/((.*)_postfix)$/).test(key)) + if ( + "string" === typeof key && + RegExp(/(.*)_postfix$/).test(key) + ) return "string" === typeof value; if ( + "string" === typeof key && RegExp( - /^(value_between_[+-]?\d+(?:\.\d+)?(?:[eE][+-]?\d+)?_and_[+-]?\d+(?:\.\d+)?(?:[eE][+-]?\d+)?)$/, + /^value_between_[+-]?\d+(?:\.\d+)?(?:[eE][+-]?\d+)?_and_[+-]?\d+(?:\.\d+)?(?:[eE][+-]?\d+)?$/, ).test(key) ) return ( diff --git a/test/generated/output/misc.prune/test_misc_prune_DynamicTag.ts b/test/generated/output/misc.prune/test_misc_prune_DynamicTag.ts new file mode 100644 index 0000000000..602561ff9c --- /dev/null +++ b/test/generated/output/misc.prune/test_misc_prune_DynamicTag.ts @@ -0,0 +1,28 @@ +import typia from "../../../../src"; +import { _test_misc_prune } from "../../../internal/_test_misc_prune"; +import { DynamicTag } from "../../../structures/DynamicTag"; + +export const test_misc_prune_DynamicTag = _test_misc_prune( + "DynamicTag", +)(DynamicTag)((input) => + ((input: DynamicTag): void => { + const $po0 = (input: any): any => { + Object.entries(input).forEach(([key, value]: any) => { + if (undefined === value) return; + if (RegExp(/^[+-]?\d+(?:\.\d+)?(?:[eE][+-]?\d+)?$/).test(key)) { + } + if (RegExp(/(.*)/).test(key)) { + } + }); + for (const key of Object.keys(input)) { + if ( + RegExp(/^[+-]?\d+(?:\.\d+)?(?:[eE][+-]?\d+)?$/).test(key) || + RegExp(/(.*)/).test(key) + ) + continue; + delete input[key]; + } + }; + if ("object" === typeof input && null !== input) $po0(input); + })(input), +); diff --git a/test/generated/output/misc.validateClone/test_misc_validateClone_DynamicComposite.ts b/test/generated/output/misc.validateClone/test_misc_validateClone_DynamicComposite.ts index 111a1609d5..9d163e332e 100644 --- a/test/generated/output/misc.validateClone/test_misc_validateClone_DynamicComposite.ts +++ b/test/generated/output/misc.validateClone/test_misc_validateClone_DynamicComposite.ts @@ -23,21 +23,27 @@ export const test_misc_validateClone_DynamicComposite = const value = input[key]; if (undefined === value) return true; if ( - RegExp( - /^[+-]?\d+(?:\.\d+)?(?:[eE][+-]?\d+)?$/, - ).test(key) + "number" === typeof Number(key) && + Number.isFinite(Number(key)) ) return ( "number" === typeof value && Number.isFinite(value) ); - if (RegExp(/^(prefix_(.*))/).test(key)) + if ( + "string" === typeof key && + RegExp(/^prefix_(.*)/).test(key) + ) return "string" === typeof value; - if (RegExp(/((.*)_postfix)$/).test(key)) + if ( + "string" === typeof key && + RegExp(/(.*)_postfix$/).test(key) + ) return "string" === typeof value; if ( + "string" === typeof key && RegExp( - /^(value_[+-]?\d+(?:\.\d+)?(?:[eE][+-]?\d+)?)$/, + /^value_[+-]?\d+(?:\.\d+)?(?:[eE][+-]?\d+)?$/, ).test(key) ) return ( @@ -47,8 +53,9 @@ export const test_misc_validateClone_DynamicComposite = "boolean" === typeof value ); if ( + "string" === typeof key && RegExp( - /^(between_(.*)_and_[+-]?\d+(?:\.\d+)?(?:[eE][+-]?\d+)?)$/, + /^between_(.*)_and_[+-]?\d+(?:\.\d+)?(?:[eE][+-]?\d+)?$/, ).test(key) ) return "boolean" === typeof value; @@ -101,9 +108,9 @@ export const test_misc_validateClone_DynamicComposite = if (undefined === value) return true; if ( - RegExp( - /^[+-]?\d+(?:\.\d+)?(?:[eE][+-]?\d+)?$/, - ).test(key) + "number" === + typeof Number(key) && + Number.isFinite(Number(key)) ) return ( ("number" === @@ -119,9 +126,8 @@ export const test_misc_validateClone_DynamicComposite = }) ); if ( - RegExp(/^(prefix_(.*))/).test( - key, - ) + "string" === typeof key && + RegExp(/^prefix_(.*)/).test(key) ) return ( "string" === typeof value || @@ -133,7 +139,8 @@ export const test_misc_validateClone_DynamicComposite = }) ); if ( - RegExp(/((.*)_postfix)$/).test( + "string" === typeof key && + RegExp(/(.*)_postfix$/).test( key, ) ) @@ -147,8 +154,9 @@ export const test_misc_validateClone_DynamicComposite = }) ); if ( + "string" === typeof key && RegExp( - /^(value_[+-]?\d+(?:\.\d+)?(?:[eE][+-]?\d+)?)$/, + /^value_[+-]?\d+(?:\.\d+)?(?:[eE][+-]?\d+)?$/, ).test(key) ) return ( @@ -169,8 +177,9 @@ export const test_misc_validateClone_DynamicComposite = }) ); if ( + "string" === typeof key && RegExp( - /^(between_(.*)_and_[+-]?\d+(?:\.\d+)?(?:[eE][+-]?\d+)?)$/, + /^between_(.*)_and_[+-]?\d+(?:\.\d+)?(?:[eE][+-]?\d+)?$/, ).test(key) ) return ( diff --git a/test/generated/output/misc.validateClone/test_misc_validateClone_DynamicNever.ts b/test/generated/output/misc.validateClone/test_misc_validateClone_DynamicNever.ts index 585680f680..f9a1f3d7ce 100644 --- a/test/generated/output/misc.validateClone/test_misc_validateClone_DynamicNever.ts +++ b/test/generated/output/misc.validateClone/test_misc_validateClone_DynamicNever.ts @@ -13,8 +13,7 @@ export const test_misc_validateClone_DynamicNever = _test_misc_validateClone( Object.keys(input).every((key: any) => { const value = input[key]; if (undefined === value) return true; - if (RegExp(/(.*)/).test(key)) - return null !== value && undefined === value; + if (true) return null !== value && undefined === value; return true; }); return ( @@ -45,7 +44,7 @@ export const test_misc_validateClone_DynamicNever = _test_misc_validateClone( .map((key: any) => { const value = input[key]; if (undefined === value) return true; - if (RegExp(/(.*)/).test(key)) + if (true) return ( (null !== value || $report(_exceptionable, { diff --git a/test/generated/output/misc.validateClone/test_misc_validateClone_DynamicTemplate.ts b/test/generated/output/misc.validateClone/test_misc_validateClone_DynamicTemplate.ts index bb06461a73..0a2c2a418b 100644 --- a/test/generated/output/misc.validateClone/test_misc_validateClone_DynamicTemplate.ts +++ b/test/generated/output/misc.validateClone/test_misc_validateClone_DynamicTemplate.ts @@ -13,13 +13,20 @@ export const test_misc_validateClone_DynamicTemplate = _test_misc_validateClone( Object.keys(input).every((key: any) => { const value = input[key]; if (undefined === value) return true; - if (RegExp(/^(prefix_(.*))/).test(key)) + if ( + "string" === typeof key && + RegExp(/^prefix_(.*)/).test(key) + ) return "string" === typeof value; - if (RegExp(/((.*)_postfix)$/).test(key)) + if ( + "string" === typeof key && + RegExp(/(.*)_postfix$/).test(key) + ) return "string" === typeof value; if ( + "string" === typeof key && RegExp( - /^(value_[+-]?\d+(?:\.\d+)?(?:[eE][+-]?\d+)?)$/, + /^value_[+-]?\d+(?:\.\d+)?(?:[eE][+-]?\d+)?$/, ).test(key) ) return ( @@ -27,8 +34,9 @@ export const test_misc_validateClone_DynamicTemplate = _test_misc_validateClone( Number.isFinite(value) ); if ( + "string" === typeof key && RegExp( - /^(between_(.*)_and_[+-]?\d+(?:\.\d+)?(?:[eE][+-]?\d+)?)$/, + /^between_(.*)_and_[+-]?\d+(?:\.\d+)?(?:[eE][+-]?\d+)?$/, ).test(key) ) return "boolean" === typeof value; @@ -62,7 +70,10 @@ export const test_misc_validateClone_DynamicTemplate = _test_misc_validateClone( .map((key: any) => { const value = input[key]; if (undefined === value) return true; - if (RegExp(/^(prefix_(.*))/).test(key)) + if ( + "string" === typeof key && + RegExp(/^prefix_(.*)/).test(key) + ) return ( "string" === typeof value || $report(_exceptionable, { @@ -71,7 +82,10 @@ export const test_misc_validateClone_DynamicTemplate = _test_misc_validateClone( value: value, }) ); - if (RegExp(/((.*)_postfix)$/).test(key)) + if ( + "string" === typeof key && + RegExp(/(.*)_postfix$/).test(key) + ) return ( "string" === typeof value || $report(_exceptionable, { @@ -81,8 +95,9 @@ export const test_misc_validateClone_DynamicTemplate = _test_misc_validateClone( }) ); if ( + "string" === typeof key && RegExp( - /^(value_[+-]?\d+(?:\.\d+)?(?:[eE][+-]?\d+)?)$/, + /^value_[+-]?\d+(?:\.\d+)?(?:[eE][+-]?\d+)?$/, ).test(key) ) return ( @@ -95,8 +110,9 @@ export const test_misc_validateClone_DynamicTemplate = _test_misc_validateClone( }) ); if ( + "string" === typeof key && RegExp( - /^(between_(.*)_and_[+-]?\d+(?:\.\d+)?(?:[eE][+-]?\d+)?)$/, + /^between_(.*)_and_[+-]?\d+(?:\.\d+)?(?:[eE][+-]?\d+)?$/, ).test(key) ) return ( diff --git a/test/generated/output/misc.validateClone/test_misc_validateClone_DynamicTree.ts b/test/generated/output/misc.validateClone/test_misc_validateClone_DynamicTree.ts index 96e489ba17..e54f22a3f3 100644 --- a/test/generated/output/misc.validateClone/test_misc_validateClone_DynamicTree.ts +++ b/test/generated/output/misc.validateClone/test_misc_validateClone_DynamicTree.ts @@ -21,7 +21,7 @@ export const test_misc_validateClone_DynamicTree = _test_misc_validateClone( Object.keys(input).every((key: any) => { const value = input[key]; if (undefined === value) return true; - if (RegExp(/(.*)/).test(key)) + if (true) return ( "object" === typeof value && null !== value && @@ -92,7 +92,7 @@ export const test_misc_validateClone_DynamicTree = _test_misc_validateClone( .map((key: any) => { const value = input[key]; if (undefined === value) return true; - if (RegExp(/(.*)/).test(key)) + if (true) return ( ((("object" === typeof value && null !== value) || @@ -152,7 +152,7 @@ export const test_misc_validateClone_DynamicTree = _test_misc_validateClone( Object.keys(input).every((key: any) => { const value = input[key]; if (undefined === value) return true; - if (RegExp(/(.*)/).test(key)) + if (true) return ( "object" === typeof value && null !== value && diff --git a/test/generated/output/misc.validateClone/test_misc_validateClone_DynamicUndefined.ts b/test/generated/output/misc.validateClone/test_misc_validateClone_DynamicUndefined.ts index 45429c12c1..16386c8591 100644 --- a/test/generated/output/misc.validateClone/test_misc_validateClone_DynamicUndefined.ts +++ b/test/generated/output/misc.validateClone/test_misc_validateClone_DynamicUndefined.ts @@ -16,7 +16,7 @@ export const test_misc_validateClone_DynamicUndefined = Object.keys(input).every((key: any) => { const value = input[key]; if (undefined === value) return true; - if (RegExp(/(.*)/).test(key)) + if (true) return null !== value && undefined === value; return true; }); @@ -49,7 +49,7 @@ export const test_misc_validateClone_DynamicUndefined = const value = input[key]; if (undefined === value) return true; - if (RegExp(/(.*)/).test(key)) + if (true) return ( (null !== value || $report( diff --git a/test/generated/output/misc.validateClone/test_misc_validateClone_DynamicUnion.ts b/test/generated/output/misc.validateClone/test_misc_validateClone_DynamicUnion.ts index 998d572c01..a755af9a00 100644 --- a/test/generated/output/misc.validateClone/test_misc_validateClone_DynamicUnion.ts +++ b/test/generated/output/misc.validateClone/test_misc_validateClone_DynamicUnion.ts @@ -14,18 +14,24 @@ export const test_misc_validateClone_DynamicUnion = _test_misc_validateClone( const value = input[key]; if (undefined === value) return true; if ( - RegExp( - /^[+-]?\d+(?:\.\d+)?(?:[eE][+-]?\d+)?$/, - ).test(key) + "number" === typeof Number(key) && + Number.isFinite(Number(key)) ) return "string" === typeof value; - if (RegExp(/^(prefix_(.*))/).test(key)) + if ( + "string" === typeof key && + RegExp(/^prefix_(.*)/).test(key) + ) return "string" === typeof value; - if (RegExp(/((.*)_postfix)$/).test(key)) + if ( + "string" === typeof key && + RegExp(/(.*)_postfix$/).test(key) + ) return "string" === typeof value; if ( + "string" === typeof key && RegExp( - /^(value_between_[+-]?\d+(?:\.\d+)?(?:[eE][+-]?\d+)?_and_[+-]?\d+(?:\.\d+)?(?:[eE][+-]?\d+)?)$/, + /^value_between_[+-]?\d+(?:\.\d+)?(?:[eE][+-]?\d+)?_and_[+-]?\d+(?:\.\d+)?(?:[eE][+-]?\d+)?$/, ).test(key) ) return ( @@ -63,9 +69,8 @@ export const test_misc_validateClone_DynamicUnion = _test_misc_validateClone( const value = input[key]; if (undefined === value) return true; if ( - RegExp( - /^[+-]?\d+(?:\.\d+)?(?:[eE][+-]?\d+)?$/, - ).test(key) + "number" === typeof Number(key) && + Number.isFinite(Number(key)) ) return ( "string" === typeof value || @@ -75,7 +80,10 @@ export const test_misc_validateClone_DynamicUnion = _test_misc_validateClone( value: value, }) ); - if (RegExp(/^(prefix_(.*))/).test(key)) + if ( + "string" === typeof key && + RegExp(/^prefix_(.*)/).test(key) + ) return ( "string" === typeof value || $report(_exceptionable, { @@ -84,7 +92,10 @@ export const test_misc_validateClone_DynamicUnion = _test_misc_validateClone( value: value, }) ); - if (RegExp(/((.*)_postfix)$/).test(key)) + if ( + "string" === typeof key && + RegExp(/(.*)_postfix$/).test(key) + ) return ( "string" === typeof value || $report(_exceptionable, { @@ -94,8 +105,9 @@ export const test_misc_validateClone_DynamicUnion = _test_misc_validateClone( }) ); if ( + "string" === typeof key && RegExp( - /^(value_between_[+-]?\d+(?:\.\d+)?(?:[eE][+-]?\d+)?_and_[+-]?\d+(?:\.\d+)?(?:[eE][+-]?\d+)?)$/, + /^value_between_[+-]?\d+(?:\.\d+)?(?:[eE][+-]?\d+)?_and_[+-]?\d+(?:\.\d+)?(?:[eE][+-]?\d+)?$/, ).test(key) ) return ( diff --git a/test/generated/output/misc.validateClone/test_misc_validateClone_ObjectDynamic.ts b/test/generated/output/misc.validateClone/test_misc_validateClone_ObjectDynamic.ts index 4f3fcf9af3..9f15eaee66 100644 --- a/test/generated/output/misc.validateClone/test_misc_validateClone_ObjectDynamic.ts +++ b/test/generated/output/misc.validateClone/test_misc_validateClone_ObjectDynamic.ts @@ -13,7 +13,7 @@ export const test_misc_validateClone_ObjectDynamic = _test_misc_validateClone( Object.keys(input).every((key: any) => { const value = input[key]; if (undefined === value) return true; - if (RegExp(/(.*)/).test(key)) + if (true) return ( "string" === typeof value || ("number" === typeof value && @@ -50,7 +50,7 @@ export const test_misc_validateClone_ObjectDynamic = _test_misc_validateClone( .map((key: any) => { const value = input[key]; if (undefined === value) return true; - if (RegExp(/(.*)/).test(key)) + if (true) return ( "string" === typeof value || ("number" === typeof value && diff --git a/test/generated/output/misc.validateClone/test_misc_validateClone_UltimateUnion.ts b/test/generated/output/misc.validateClone/test_misc_validateClone_UltimateUnion.ts index 00d765f682..3d66965189 100644 --- a/test/generated/output/misc.validateClone/test_misc_validateClone_UltimateUnion.ts +++ b/test/generated/output/misc.validateClone/test_misc_validateClone_UltimateUnion.ts @@ -519,7 +519,7 @@ export const test_misc_validateClone_UltimateUnion = _test_misc_validateClone( Object.keys(input).every((key: any) => { const value = input[key]; if (undefined === value) return true; - if (RegExp(/(.*)/).test(key)) + if (true) return ( "object" === typeof value && null !== value && @@ -586,7 +586,7 @@ export const test_misc_validateClone_UltimateUnion = _test_misc_validateClone( Object.keys(input).every((key: any) => { const value = input[key]; if (undefined === value) return true; - if (RegExp(/(.*)/).test(key)) + if (true) return ( "object" === typeof value && null !== value && @@ -3581,7 +3581,7 @@ export const test_misc_validateClone_UltimateUnion = _test_misc_validateClone( .map((key: any) => { const value = input[key]; if (undefined === value) return true; - if (RegExp(/(.*)/).test(key)) + if (true) return ( ((("object" === typeof value && null !== value && @@ -3869,7 +3869,7 @@ export const test_misc_validateClone_UltimateUnion = _test_misc_validateClone( .map((key: any) => { const value = input[key]; if (undefined === value) return true; - if (RegExp(/(.*)/).test(key)) + if (true) return ( ((("object" === typeof value && null !== value && @@ -6931,7 +6931,7 @@ export const test_misc_validateClone_UltimateUnion = _test_misc_validateClone( Object.keys(input).every((key: any) => { const value = input[key]; if (undefined === value) return true; - if (RegExp(/(.*)/).test(key)) + if (true) return ( "object" === typeof value && null !== value && @@ -6993,7 +6993,7 @@ export const test_misc_validateClone_UltimateUnion = _test_misc_validateClone( Object.keys(input).every((key: any) => { const value = input[key]; if (undefined === value) return true; - if (RegExp(/(.*)/).test(key)) + if (true) return ( "object" === typeof value && null !== value && diff --git a/test/generated/output/misc.validatePrune/test_misc_validatePrune_DynamicComposite.ts b/test/generated/output/misc.validatePrune/test_misc_validatePrune_DynamicComposite.ts index 15d06eebad..edafc0829e 100644 --- a/test/generated/output/misc.validatePrune/test_misc_validatePrune_DynamicComposite.ts +++ b/test/generated/output/misc.validatePrune/test_misc_validatePrune_DynamicComposite.ts @@ -23,21 +23,27 @@ export const test_misc_validatePrune_DynamicComposite = const value = input[key]; if (undefined === value) return true; if ( - RegExp( - /^[+-]?\d+(?:\.\d+)?(?:[eE][+-]?\d+)?$/, - ).test(key) + "number" === typeof Number(key) && + Number.isFinite(Number(key)) ) return ( "number" === typeof value && Number.isFinite(value) ); - if (RegExp(/^(prefix_(.*))/).test(key)) + if ( + "string" === typeof key && + RegExp(/^prefix_(.*)/).test(key) + ) return "string" === typeof value; - if (RegExp(/((.*)_postfix)$/).test(key)) + if ( + "string" === typeof key && + RegExp(/(.*)_postfix$/).test(key) + ) return "string" === typeof value; if ( + "string" === typeof key && RegExp( - /^(value_[+-]?\d+(?:\.\d+)?(?:[eE][+-]?\d+)?)$/, + /^value_[+-]?\d+(?:\.\d+)?(?:[eE][+-]?\d+)?$/, ).test(key) ) return ( @@ -47,8 +53,9 @@ export const test_misc_validatePrune_DynamicComposite = "boolean" === typeof value ); if ( + "string" === typeof key && RegExp( - /^(between_(.*)_and_[+-]?\d+(?:\.\d+)?(?:[eE][+-]?\d+)?)$/, + /^between_(.*)_and_[+-]?\d+(?:\.\d+)?(?:[eE][+-]?\d+)?$/, ).test(key) ) return "boolean" === typeof value; @@ -101,9 +108,9 @@ export const test_misc_validatePrune_DynamicComposite = if (undefined === value) return true; if ( - RegExp( - /^[+-]?\d+(?:\.\d+)?(?:[eE][+-]?\d+)?$/, - ).test(key) + "number" === + typeof Number(key) && + Number.isFinite(Number(key)) ) return ( ("number" === @@ -119,9 +126,8 @@ export const test_misc_validatePrune_DynamicComposite = }) ); if ( - RegExp(/^(prefix_(.*))/).test( - key, - ) + "string" === typeof key && + RegExp(/^prefix_(.*)/).test(key) ) return ( "string" === typeof value || @@ -133,7 +139,8 @@ export const test_misc_validatePrune_DynamicComposite = }) ); if ( - RegExp(/((.*)_postfix)$/).test( + "string" === typeof key && + RegExp(/(.*)_postfix$/).test( key, ) ) @@ -147,8 +154,9 @@ export const test_misc_validatePrune_DynamicComposite = }) ); if ( + "string" === typeof key && RegExp( - /^(value_[+-]?\d+(?:\.\d+)?(?:[eE][+-]?\d+)?)$/, + /^value_[+-]?\d+(?:\.\d+)?(?:[eE][+-]?\d+)?$/, ).test(key) ) return ( @@ -169,8 +177,9 @@ export const test_misc_validatePrune_DynamicComposite = }) ); if ( + "string" === typeof key && RegExp( - /^(between_(.*)_and_[+-]?\d+(?:\.\d+)?(?:[eE][+-]?\d+)?)$/, + /^between_(.*)_and_[+-]?\d+(?:\.\d+)?(?:[eE][+-]?\d+)?$/, ).test(key) ) return ( diff --git a/test/generated/output/misc.validatePrune/test_misc_validatePrune_DynamicTag.ts b/test/generated/output/misc.validatePrune/test_misc_validatePrune_DynamicTag.ts new file mode 100644 index 0000000000..e308eee53c --- /dev/null +++ b/test/generated/output/misc.validatePrune/test_misc_validatePrune_DynamicTag.ts @@ -0,0 +1,180 @@ +import typia from "../../../../src"; +import { _test_misc_validatePrune } from "../../../internal/_test_misc_validatePrune"; +import { DynamicTag } from "../../../structures/DynamicTag"; + +export const test_misc_validatePrune_DynamicTag = _test_misc_validatePrune( + "DynamicTag", +)(DynamicTag)((input) => + ((input: any): typia.IValidation => { + const validate = (input: any): typia.IValidation => { + const errors = [] as any[]; + const __is = (input: any): input is DynamicTag => { + const $io0 = (input: any): boolean => + Object.keys(input).every((key: any) => { + const value = input[key]; + if (undefined === value) return true; + if ( + "number" === typeof Number(key) && + 0 <= Number(key) && + Number(key) < 10 + ) + return ( + "bigint" === typeof value && BigInt(0) <= value + ); + if ( + "string" === typeof key && + /^(?:[0-9a-f]{8}-[0-9a-f]{4}-[1-5][0-9a-f]{3}-[89ab][0-9a-f]{3}-[0-9a-f]{12}|00000000-0000-0000-0000-000000000000)$/i.test( + key, + ) + ) + return ( + "string" === typeof value && + /^(([^<>()[\]\.,;:\s@\"]+(\.[^<>()[\]\.,;:\s@\"]+)*)|(\".+\"))@(([^<>()[\]\.,;:\s@\"]+\.)+[^<>()[\]\.,;:\s@\"]{2,})$/i.test( + value, + ) + ); + return true; + }); + return ( + "object" === typeof input && + null !== input && + false === Array.isArray(input) && + $io0(input) + ); + }; + if (false === __is(input)) { + const $report = (typia.misc.validatePrune as any).report( + errors, + ); + (( + input: any, + _path: string, + _exceptionable: boolean = true, + ): input is DynamicTag => { + const $join = (typia.misc.validatePrune as any).join; + const $vo0 = ( + input: any, + _path: string, + _exceptionable: boolean = true, + ): boolean => + [ + false === _exceptionable || + Object.keys(input) + .map((key: any) => { + const value = input[key]; + if (undefined === value) return true; + if ( + "number" === typeof Number(key) && + 0 <= Number(key) && + Number(key) < 10 + ) + return ( + ("bigint" === typeof value && + (BigInt(0) <= value || + $report( + _exceptionable, + { + path: + _path + + $join(key), + expected: + 'bigint & Type<"uint64">', + value: value, + }, + ))) || + $report(_exceptionable, { + path: _path + $join(key), + expected: + '(bigint & Type<"uint64">)', + value: value, + }) + ); + if ( + "string" === typeof key && + /^(?:[0-9a-f]{8}-[0-9a-f]{4}-[1-5][0-9a-f]{3}-[89ab][0-9a-f]{3}-[0-9a-f]{12}|00000000-0000-0000-0000-000000000000)$/i.test( + key, + ) + ) + return ( + ("string" === typeof value && + (/^(([^<>()[\]\.,;:\s@\"]+(\.[^<>()[\]\.,;:\s@\"]+)*)|(\".+\"))@(([^<>()[\]\.,;:\s@\"]+\.)+[^<>()[\]\.,;:\s@\"]{2,})$/i.test( + value, + ) || + $report( + _exceptionable, + { + path: + _path + + $join(key), + expected: + 'string & Format<"email">', + value: value, + }, + ))) || + $report(_exceptionable, { + path: _path + $join(key), + expected: + '(string & Format<"email">)', + value: value, + }) + ); + return true; + }) + .every((flag: boolean) => flag), + ].every((flag: boolean) => flag); + return ( + ((("object" === typeof input && + null !== input && + false === Array.isArray(input)) || + $report(true, { + path: _path + "", + expected: "DynamicTag", + value: input, + })) && + $vo0(input, _path + "", true)) || + $report(true, { + path: _path + "", + expected: "DynamicTag", + value: input, + }) + ); + })(input, "$input", true); + } + const success = 0 === errors.length; + return { + success, + errors, + data: success ? input : undefined, + } as any; + }; + const prune = (input: DynamicTag): void => { + const $po0 = (input: any): any => { + Object.entries(input).forEach(([key, value]: any) => { + if (undefined === value) return; + if ( + RegExp(/^[+-]?\d+(?:\.\d+)?(?:[eE][+-]?\d+)?$/).test( + key, + ) + ) { + } + if (RegExp(/(.*)/).test(key)) { + } + }); + for (const key of Object.keys(input)) { + if ( + RegExp(/^[+-]?\d+(?:\.\d+)?(?:[eE][+-]?\d+)?$/).test( + key, + ) || + RegExp(/(.*)/).test(key) + ) + continue; + delete input[key]; + } + }; + if ("object" === typeof input && null !== input) $po0(input); + }; + const output = validate(input); + if (output.success) prune(input); + return output; + })(input), +); diff --git a/test/generated/output/misc.validatePrune/test_misc_validatePrune_DynamicTemplate.ts b/test/generated/output/misc.validatePrune/test_misc_validatePrune_DynamicTemplate.ts index f4e0cff6d0..bdda2d5fba 100644 --- a/test/generated/output/misc.validatePrune/test_misc_validatePrune_DynamicTemplate.ts +++ b/test/generated/output/misc.validatePrune/test_misc_validatePrune_DynamicTemplate.ts @@ -13,13 +13,20 @@ export const test_misc_validatePrune_DynamicTemplate = _test_misc_validatePrune( Object.keys(input).every((key: any) => { const value = input[key]; if (undefined === value) return true; - if (RegExp(/^(prefix_(.*))/).test(key)) + if ( + "string" === typeof key && + RegExp(/^prefix_(.*)/).test(key) + ) return "string" === typeof value; - if (RegExp(/((.*)_postfix)$/).test(key)) + if ( + "string" === typeof key && + RegExp(/(.*)_postfix$/).test(key) + ) return "string" === typeof value; if ( + "string" === typeof key && RegExp( - /^(value_[+-]?\d+(?:\.\d+)?(?:[eE][+-]?\d+)?)$/, + /^value_[+-]?\d+(?:\.\d+)?(?:[eE][+-]?\d+)?$/, ).test(key) ) return ( @@ -27,8 +34,9 @@ export const test_misc_validatePrune_DynamicTemplate = _test_misc_validatePrune( Number.isFinite(value) ); if ( + "string" === typeof key && RegExp( - /^(between_(.*)_and_[+-]?\d+(?:\.\d+)?(?:[eE][+-]?\d+)?)$/, + /^between_(.*)_and_[+-]?\d+(?:\.\d+)?(?:[eE][+-]?\d+)?$/, ).test(key) ) return "boolean" === typeof value; @@ -62,7 +70,10 @@ export const test_misc_validatePrune_DynamicTemplate = _test_misc_validatePrune( .map((key: any) => { const value = input[key]; if (undefined === value) return true; - if (RegExp(/^(prefix_(.*))/).test(key)) + if ( + "string" === typeof key && + RegExp(/^prefix_(.*)/).test(key) + ) return ( "string" === typeof value || $report(_exceptionable, { @@ -71,7 +82,10 @@ export const test_misc_validatePrune_DynamicTemplate = _test_misc_validatePrune( value: value, }) ); - if (RegExp(/((.*)_postfix)$/).test(key)) + if ( + "string" === typeof key && + RegExp(/(.*)_postfix$/).test(key) + ) return ( "string" === typeof value || $report(_exceptionable, { @@ -81,8 +95,9 @@ export const test_misc_validatePrune_DynamicTemplate = _test_misc_validatePrune( }) ); if ( + "string" === typeof key && RegExp( - /^(value_[+-]?\d+(?:\.\d+)?(?:[eE][+-]?\d+)?)$/, + /^value_[+-]?\d+(?:\.\d+)?(?:[eE][+-]?\d+)?$/, ).test(key) ) return ( @@ -95,8 +110,9 @@ export const test_misc_validatePrune_DynamicTemplate = _test_misc_validatePrune( }) ); if ( + "string" === typeof key && RegExp( - /^(between_(.*)_and_[+-]?\d+(?:\.\d+)?(?:[eE][+-]?\d+)?)$/, + /^between_(.*)_and_[+-]?\d+(?:\.\d+)?(?:[eE][+-]?\d+)?$/, ).test(key) ) return ( diff --git a/test/generated/output/misc.validatePrune/test_misc_validatePrune_DynamicUnion.ts b/test/generated/output/misc.validatePrune/test_misc_validatePrune_DynamicUnion.ts index 361d2c652b..83e51c16c3 100644 --- a/test/generated/output/misc.validatePrune/test_misc_validatePrune_DynamicUnion.ts +++ b/test/generated/output/misc.validatePrune/test_misc_validatePrune_DynamicUnion.ts @@ -14,18 +14,24 @@ export const test_misc_validatePrune_DynamicUnion = _test_misc_validatePrune( const value = input[key]; if (undefined === value) return true; if ( - RegExp( - /^[+-]?\d+(?:\.\d+)?(?:[eE][+-]?\d+)?$/, - ).test(key) + "number" === typeof Number(key) && + Number.isFinite(Number(key)) ) return "string" === typeof value; - if (RegExp(/^(prefix_(.*))/).test(key)) + if ( + "string" === typeof key && + RegExp(/^prefix_(.*)/).test(key) + ) return "string" === typeof value; - if (RegExp(/((.*)_postfix)$/).test(key)) + if ( + "string" === typeof key && + RegExp(/(.*)_postfix$/).test(key) + ) return "string" === typeof value; if ( + "string" === typeof key && RegExp( - /^(value_between_[+-]?\d+(?:\.\d+)?(?:[eE][+-]?\d+)?_and_[+-]?\d+(?:\.\d+)?(?:[eE][+-]?\d+)?)$/, + /^value_between_[+-]?\d+(?:\.\d+)?(?:[eE][+-]?\d+)?_and_[+-]?\d+(?:\.\d+)?(?:[eE][+-]?\d+)?$/, ).test(key) ) return ( @@ -63,9 +69,8 @@ export const test_misc_validatePrune_DynamicUnion = _test_misc_validatePrune( const value = input[key]; if (undefined === value) return true; if ( - RegExp( - /^[+-]?\d+(?:\.\d+)?(?:[eE][+-]?\d+)?$/, - ).test(key) + "number" === typeof Number(key) && + Number.isFinite(Number(key)) ) return ( "string" === typeof value || @@ -75,7 +80,10 @@ export const test_misc_validatePrune_DynamicUnion = _test_misc_validatePrune( value: value, }) ); - if (RegExp(/^(prefix_(.*))/).test(key)) + if ( + "string" === typeof key && + RegExp(/^prefix_(.*)/).test(key) + ) return ( "string" === typeof value || $report(_exceptionable, { @@ -84,7 +92,10 @@ export const test_misc_validatePrune_DynamicUnion = _test_misc_validatePrune( value: value, }) ); - if (RegExp(/((.*)_postfix)$/).test(key)) + if ( + "string" === typeof key && + RegExp(/(.*)_postfix$/).test(key) + ) return ( "string" === typeof value || $report(_exceptionable, { @@ -94,8 +105,9 @@ export const test_misc_validatePrune_DynamicUnion = _test_misc_validatePrune( }) ); if ( + "string" === typeof key && RegExp( - /^(value_between_[+-]?\d+(?:\.\d+)?(?:[eE][+-]?\d+)?_and_[+-]?\d+(?:\.\d+)?(?:[eE][+-]?\d+)?)$/, + /^value_between_[+-]?\d+(?:\.\d+)?(?:[eE][+-]?\d+)?_and_[+-]?\d+(?:\.\d+)?(?:[eE][+-]?\d+)?$/, ).test(key) ) return ( diff --git a/test/generated/output/notation.camel/test_notation_camel_DynamicComposite.ts b/test/generated/output/notation.camel/test_notation_camel_DynamicComposite.ts index 75990936b8..2580683227 100644 --- a/test/generated/output/notation.camel/test_notation_camel_DynamicComposite.ts +++ b/test/generated/output/notation.camel/test_notation_camel_DynamicComposite.ts @@ -28,21 +28,27 @@ export const test_notation_validateCamel_DynamicComposite = const value = input[key]; if (undefined === value) return true; if ( - RegExp( - /^[+-]?\d+(?:\.\d+)?(?:[eE][+-]?\d+)?$/, - ).test(key) + "number" === typeof Number(key) && + Number.isFinite(Number(key)) ) return ( "number" === typeof value && Number.isFinite(value) ); - if (RegExp(/^(prefix_(.*))/).test(key)) + if ( + "string" === typeof key && + RegExp(/^prefix_(.*)/).test(key) + ) return "string" === typeof value; - if (RegExp(/((.*)_postfix)$/).test(key)) + if ( + "string" === typeof key && + RegExp(/(.*)_postfix$/).test(key) + ) return "string" === typeof value; if ( + "string" === typeof key && RegExp( - /^(value_[+-]?\d+(?:\.\d+)?(?:[eE][+-]?\d+)?)$/, + /^value_[+-]?\d+(?:\.\d+)?(?:[eE][+-]?\d+)?$/, ).test(key) ) return ( @@ -52,8 +58,9 @@ export const test_notation_validateCamel_DynamicComposite = "boolean" === typeof value ); if ( + "string" === typeof key && RegExp( - /^(between_(.*)_and_[+-]?\d+(?:\.\d+)?(?:[eE][+-]?\d+)?)$/, + /^between_(.*)_and_[+-]?\d+(?:\.\d+)?(?:[eE][+-]?\d+)?$/, ).test(key) ) return "boolean" === typeof value; @@ -108,9 +115,9 @@ export const test_notation_validateCamel_DynamicComposite = if (undefined === value) return true; if ( - RegExp( - /^[+-]?\d+(?:\.\d+)?(?:[eE][+-]?\d+)?$/, - ).test(key) + "number" === + typeof Number(key) && + Number.isFinite(Number(key)) ) return ( ("number" === @@ -131,9 +138,10 @@ export const test_notation_validateCamel_DynamicComposite = ) ); if ( - RegExp( - /^(prefix_(.*))/, - ).test(key) + "string" === typeof key && + RegExp(/^prefix_(.*)/).test( + key, + ) ) return ( "string" === @@ -151,8 +159,9 @@ export const test_notation_validateCamel_DynamicComposite = ) ); if ( + "string" === typeof key && RegExp( - /((.*)_postfix)$/, + /(.*)_postfix$/, ).test(key) ) return ( @@ -171,8 +180,9 @@ export const test_notation_validateCamel_DynamicComposite = ) ); if ( + "string" === typeof key && RegExp( - /^(value_[+-]?\d+(?:\.\d+)?(?:[eE][+-]?\d+)?)$/, + /^value_[+-]?\d+(?:\.\d+)?(?:[eE][+-]?\d+)?$/, ).test(key) ) return ( @@ -198,8 +208,9 @@ export const test_notation_validateCamel_DynamicComposite = ) ); if ( + "string" === typeof key && RegExp( - /^(between_(.*)_and_[+-]?\d+(?:\.\d+)?(?:[eE][+-]?\d+)?)$/, + /^between_(.*)_and_[+-]?\d+(?:\.\d+)?(?:[eE][+-]?\d+)?$/, ).test(key) ) return ( @@ -316,21 +327,27 @@ export const test_notation_validateCamel_DynamicComposite = const value = input[key]; if (undefined === value) return true; if ( - RegExp( - /^[+-]?\d+(?:\.\d+)?(?:[eE][+-]?\d+)?$/, - ).test(key) + "number" === typeof Number(key) && + Number.isFinite(Number(key)) ) return ( "number" === typeof value && Number.isFinite(value) ); - if (RegExp(/^(prefix_(.*))/).test(key)) + if ( + "string" === typeof key && + RegExp(/^prefix_(.*)/).test(key) + ) return "string" === typeof value; - if (RegExp(/((.*)_postfix)$/).test(key)) + if ( + "string" === typeof key && + RegExp(/(.*)_postfix$/).test(key) + ) return "string" === typeof value; if ( + "string" === typeof key && RegExp( - /^(value_[+-]?\d+(?:\.\d+)?(?:[eE][+-]?\d+)?)$/, + /^value_[+-]?\d+(?:\.\d+)?(?:[eE][+-]?\d+)?$/, ).test(key) ) return ( @@ -340,8 +357,9 @@ export const test_notation_validateCamel_DynamicComposite = "boolean" === typeof value ); if ( + "string" === typeof key && RegExp( - /^(between_(.*)_and_[+-]?\d+(?:\.\d+)?(?:[eE][+-]?\d+)?)$/, + /^between_(.*)_and_[+-]?\d+(?:\.\d+)?(?:[eE][+-]?\d+)?$/, ).test(key) ) return "boolean" === typeof value; @@ -387,9 +405,8 @@ export const test_notation_validateCamel_DynamicComposite = const value = input[key]; if (undefined === value) return true; if ( - RegExp( - /^[+-]?\d+(?:\.\d+)?(?:[eE][+-]?\d+)?$/, - ).test(key) + "number" === typeof Number(key) && + Number.isFinite(Number(key)) ) return ( ("number" === typeof value && @@ -400,7 +417,10 @@ export const test_notation_validateCamel_DynamicComposite = value: value, }) ); - if (RegExp(/^(prefix_(.*))/).test(key)) + if ( + "string" === typeof key && + RegExp(/^prefix_(.*)/).test(key) + ) return ( "string" === typeof value || $guard(_exceptionable, { @@ -409,7 +429,10 @@ export const test_notation_validateCamel_DynamicComposite = value: value, }) ); - if (RegExp(/((.*)_postfix)$/).test(key)) + if ( + "string" === typeof key && + RegExp(/(.*)_postfix$/).test(key) + ) return ( "string" === typeof value || $guard(_exceptionable, { @@ -419,8 +442,9 @@ export const test_notation_validateCamel_DynamicComposite = }) ); if ( + "string" === typeof key && RegExp( - /^(value_[+-]?\d+(?:\.\d+)?(?:[eE][+-]?\d+)?)$/, + /^value_[+-]?\d+(?:\.\d+)?(?:[eE][+-]?\d+)?$/, ).test(key) ) return ( @@ -436,8 +460,9 @@ export const test_notation_validateCamel_DynamicComposite = }) ); if ( + "string" === typeof key && RegExp( - /^(between_(.*)_and_[+-]?\d+(?:\.\d+)?(?:[eE][+-]?\d+)?)$/, + /^between_(.*)_and_[+-]?\d+(?:\.\d+)?(?:[eE][+-]?\d+)?$/, ).test(key) ) return ( diff --git a/test/generated/output/notation.camel/test_notation_camel_DynamicNever.ts b/test/generated/output/notation.camel/test_notation_camel_DynamicNever.ts index b9a1ccdfa2..ca9d14c30c 100644 --- a/test/generated/output/notation.camel/test_notation_camel_DynamicNever.ts +++ b/test/generated/output/notation.camel/test_notation_camel_DynamicNever.ts @@ -17,7 +17,7 @@ export const test_notation_validateCamel_DynamicNever = Object.keys(input).every((key: any) => { const value = input[key]; if (undefined === value) return true; - if (RegExp(/(.*)/).test(key)) + if (true) return ( null !== value && undefined === value ); @@ -53,7 +53,7 @@ export const test_notation_validateCamel_DynamicNever = const value = input[key]; if (undefined === value) return true; - if (RegExp(/(.*)/).test(key)) + if (true) return ( (null !== value || $report( @@ -142,8 +142,7 @@ export const test_notation_validateCamel_DynamicNever = Object.keys(input).every((key: any) => { const value = input[key]; if (undefined === value) return true; - if (RegExp(/(.*)/).test(key)) - return null !== value && undefined === value; + if (true) return null !== value && undefined === value; return true; }); return ( @@ -170,7 +169,7 @@ export const test_notation_validateCamel_DynamicNever = Object.keys(input).every((key: any) => { const value = input[key]; if (undefined === value) return true; - if (RegExp(/(.*)/).test(key)) + if (true) return ( (null !== value || $guard(_exceptionable, { diff --git a/test/generated/output/notation.camel/test_notation_camel_DynamicTag.ts b/test/generated/output/notation.camel/test_notation_camel_DynamicTag.ts new file mode 100644 index 0000000000..f9c658eaa7 --- /dev/null +++ b/test/generated/output/notation.camel/test_notation_camel_DynamicTag.ts @@ -0,0 +1,320 @@ +import typia from "../../../../src"; +import { _test_notation_validateGeneral } from "../../../internal/_test_notation_validateGeneral"; +import { DynamicTag } from "../../../structures/DynamicTag"; + +export const test_notation_validateCamel_DynamicTag = + _test_notation_validateGeneral("DynamicTag")(DynamicTag)< + typia.CamelCase + >({ + convert: (input) => + ((input: any): typia.IValidation> => { + const validate = ( + input: any, + ): typia.IValidation => { + const errors = [] as any[]; + const __is = (input: any): input is DynamicTag => { + const $io0 = (input: any): boolean => + Object.keys(input).every((key: any) => { + const value = input[key]; + if (undefined === value) return true; + if ( + "number" === typeof Number(key) && + 0 <= Number(key) && + Number(key) < 10 + ) + return ( + "bigint" === typeof value && + BigInt(0) <= value + ); + if ( + "string" === typeof key && + /^(?:[0-9a-f]{8}-[0-9a-f]{4}-[1-5][0-9a-f]{3}-[89ab][0-9a-f]{3}-[0-9a-f]{12}|00000000-0000-0000-0000-000000000000)$/i.test( + key, + ) + ) + return ( + "string" === typeof value && + /^(([^<>()[\]\.,;:\s@\"]+(\.[^<>()[\]\.,;:\s@\"]+)*)|(\".+\"))@(([^<>()[\]\.,;:\s@\"]+\.)+[^<>()[\]\.,;:\s@\"]{2,})$/i.test( + value, + ) + ); + return true; + }); + return ( + "object" === typeof input && + null !== input && + false === Array.isArray(input) && + $io0(input) + ); + }; + if (false === __is(input)) { + const $report = ( + typia.notations.validateCamel as any + ).report(errors); + (( + input: any, + _path: string, + _exceptionable: boolean = true, + ): input is DynamicTag => { + const $join = (typia.notations.validateCamel as any) + .join; + const $vo0 = ( + input: any, + _path: string, + _exceptionable: boolean = true, + ): boolean => + [ + false === _exceptionable || + Object.keys(input) + .map((key: any) => { + const value = input[key]; + if (undefined === value) + return true; + if ( + "number" === + typeof Number(key) && + 0 <= Number(key) && + Number(key) < 10 + ) + return ( + ("bigint" === + typeof value && + (BigInt(0) <= + value || + $report( + _exceptionable, + { + path: + _path + + $join( + key, + ), + expected: + 'bigint & Type<"uint64">', + value: value, + }, + ))) || + $report( + _exceptionable, + { + path: + _path + + $join(key), + expected: + '(bigint & Type<"uint64">)', + value: value, + }, + ) + ); + if ( + "string" === typeof key && + /^(?:[0-9a-f]{8}-[0-9a-f]{4}-[1-5][0-9a-f]{3}-[89ab][0-9a-f]{3}-[0-9a-f]{12}|00000000-0000-0000-0000-000000000000)$/i.test( + key, + ) + ) + return ( + ("string" === + typeof value && + (/^(([^<>()[\]\.,;:\s@\"]+(\.[^<>()[\]\.,;:\s@\"]+)*)|(\".+\"))@(([^<>()[\]\.,;:\s@\"]+\.)+[^<>()[\]\.,;:\s@\"]{2,})$/i.test( + value, + ) || + $report( + _exceptionable, + { + path: + _path + + $join( + key, + ), + expected: + 'string & Format<"email">', + value: value, + }, + ))) || + $report( + _exceptionable, + { + path: + _path + + $join(key), + expected: + '(string & Format<"email">)', + value: value, + }, + ) + ); + return true; + }) + .every((flag: boolean) => flag), + ].every((flag: boolean) => flag); + return ( + ((("object" === typeof input && + null !== input && + false === Array.isArray(input)) || + $report(true, { + path: _path + "", + expected: "DynamicTag", + value: input, + })) && + $vo0(input, _path + "", true)) || + $report(true, { + path: _path + "", + expected: "DynamicTag", + value: input, + }) + ); + })(input, "$input", true); + } + const success = 0 === errors.length; + return { + success, + errors, + data: success ? input : undefined, + } as any; + }; + const general = ( + input: DynamicTag, + ): typia.CamelCase => { + const $co0 = (input: any): any => { + const output = {} as any; + for (const [key, value] of Object.entries(input)) { + if ( + RegExp( + /^[+-]?\d+(?:\.\d+)?(?:[eE][+-]?\d+)?$/, + ).test(key) + ) { + output[key] = value as any; + continue; + } + if (RegExp(/(.*)/).test(key)) { + output[key] = value as any; + continue; + } + } + return output; + }; + return "object" === typeof input && null !== input + ? $co0(input) + : (input as any); + }; + const output = validate(input) as any; + if (output.success) output.data = general(input); + return output; + })(input), + assert: (input: any): typia.CamelCase => { + const __is = (input: any): input is typia.CamelCase => { + const $io0 = (input: any): boolean => + Object.keys(input).every((key: any) => { + const value = input[key]; + if (undefined === value) return true; + if ( + "number" === typeof Number(key) && + 0 <= Number(key) && + Number(key) < 10 + ) + return ( + "bigint" === typeof value && BigInt(0) <= value + ); + if ( + "string" === typeof key && + /^(?:[0-9a-f]{8}-[0-9a-f]{4}-[1-5][0-9a-f]{3}-[89ab][0-9a-f]{3}-[0-9a-f]{12}|00000000-0000-0000-0000-000000000000)$/i.test( + key, + ) + ) + return ( + "string" === typeof value && + /^(([^<>()[\]\.,;:\s@\"]+(\.[^<>()[\]\.,;:\s@\"]+)*)|(\".+\"))@(([^<>()[\]\.,;:\s@\"]+\.)+[^<>()[\]\.,;:\s@\"]{2,})$/i.test( + value, + ) + ); + return true; + }); + return ( + "object" === typeof input && + null !== input && + false === Array.isArray(input) && + $io0(input) + ); + }; + if (false === __is(input)) + (( + input: any, + _path: string, + _exceptionable: boolean = true, + ): input is typia.CamelCase => { + const $guard = (typia.createAssert as any).guard; + const $join = (typia.createAssert as any).join; + const $ao0 = ( + input: any, + _path: string, + _exceptionable: boolean = true, + ): boolean => + false === _exceptionable || + Object.keys(input).every((key: any) => { + const value = input[key]; + if (undefined === value) return true; + if ( + "number" === typeof Number(key) && + 0 <= Number(key) && + Number(key) < 10 + ) + return ( + ("bigint" === typeof value && + (BigInt(0) <= value || + $guard(_exceptionable, { + path: _path + $join(key), + expected: + 'bigint & Type<"uint64">', + value: value, + }))) || + $guard(_exceptionable, { + path: _path + $join(key), + expected: '(bigint & Type<"uint64">)', + value: value, + }) + ); + if ( + "string" === typeof key && + /^(?:[0-9a-f]{8}-[0-9a-f]{4}-[1-5][0-9a-f]{3}-[89ab][0-9a-f]{3}-[0-9a-f]{12}|00000000-0000-0000-0000-000000000000)$/i.test( + key, + ) + ) + return ( + ("string" === typeof value && + (/^(([^<>()[\]\.,;:\s@\"]+(\.[^<>()[\]\.,;:\s@\"]+)*)|(\".+\"))@(([^<>()[\]\.,;:\s@\"]+\.)+[^<>()[\]\.,;:\s@\"]{2,})$/i.test( + value, + ) || + $guard(_exceptionable, { + path: _path + $join(key), + expected: + 'string & Format<"email">', + value: value, + }))) || + $guard(_exceptionable, { + path: _path + $join(key), + expected: '(string & Format<"email">)', + value: value, + }) + ); + return true; + }); + return ( + ((("object" === typeof input && + null !== input && + false === Array.isArray(input)) || + $guard(true, { + path: _path + "", + expected: "DynamicTag", + value: input, + })) && + $ao0(input, _path + "", true)) || + $guard(true, { + path: _path + "", + expected: "DynamicTag", + value: input, + }) + ); + })(input, "$input", true); + return input; + }, + }); diff --git a/test/generated/output/notation.camel/test_notation_camel_DynamicTemplate.ts b/test/generated/output/notation.camel/test_notation_camel_DynamicTemplate.ts index dd5b1b070c..6583dbb207 100644 --- a/test/generated/output/notation.camel/test_notation_camel_DynamicTemplate.ts +++ b/test/generated/output/notation.camel/test_notation_camel_DynamicTemplate.ts @@ -19,13 +19,20 @@ export const test_notation_validateCamel_DynamicTemplate = Object.keys(input).every((key: any) => { const value = input[key]; if (undefined === value) return true; - if (RegExp(/^(prefix_(.*))/).test(key)) + if ( + "string" === typeof key && + RegExp(/^prefix_(.*)/).test(key) + ) return "string" === typeof value; - if (RegExp(/((.*)_postfix)$/).test(key)) + if ( + "string" === typeof key && + RegExp(/(.*)_postfix$/).test(key) + ) return "string" === typeof value; if ( + "string" === typeof key && RegExp( - /^(value_[+-]?\d+(?:\.\d+)?(?:[eE][+-]?\d+)?)$/, + /^value_[+-]?\d+(?:\.\d+)?(?:[eE][+-]?\d+)?$/, ).test(key) ) return ( @@ -33,8 +40,9 @@ export const test_notation_validateCamel_DynamicTemplate = Number.isFinite(value) ); if ( + "string" === typeof key && RegExp( - /^(between_(.*)_and_[+-]?\d+(?:\.\d+)?(?:[eE][+-]?\d+)?)$/, + /^between_(.*)_and_[+-]?\d+(?:\.\d+)?(?:[eE][+-]?\d+)?$/, ).test(key) ) return "boolean" === typeof value; @@ -71,9 +79,10 @@ export const test_notation_validateCamel_DynamicTemplate = if (undefined === value) return true; if ( - RegExp( - /^(prefix_(.*))/, - ).test(key) + "string" === typeof key && + RegExp(/^prefix_(.*)/).test( + key, + ) ) return ( "string" === @@ -91,8 +100,9 @@ export const test_notation_validateCamel_DynamicTemplate = ) ); if ( + "string" === typeof key && RegExp( - /((.*)_postfix)$/, + /(.*)_postfix$/, ).test(key) ) return ( @@ -111,8 +121,9 @@ export const test_notation_validateCamel_DynamicTemplate = ) ); if ( + "string" === typeof key && RegExp( - /^(value_[+-]?\d+(?:\.\d+)?(?:[eE][+-]?\d+)?)$/, + /^value_[+-]?\d+(?:\.\d+)?(?:[eE][+-]?\d+)?$/, ).test(key) ) return ( @@ -134,8 +145,9 @@ export const test_notation_validateCamel_DynamicTemplate = ) ); if ( + "string" === typeof key && RegExp( - /^(between_(.*)_and_[+-]?\d+(?:\.\d+)?(?:[eE][+-]?\d+)?)$/, + /^between_(.*)_and_[+-]?\d+(?:\.\d+)?(?:[eE][+-]?\d+)?$/, ).test(key) ) return ( @@ -231,13 +243,20 @@ export const test_notation_validateCamel_DynamicTemplate = Object.keys(input).every((key: any) => { const value = input[key]; if (undefined === value) return true; - if (RegExp(/^(prefix_(.*))/).test(key)) + if ( + "string" === typeof key && + RegExp(/^prefix_(.*)/).test(key) + ) return "string" === typeof value; - if (RegExp(/((.*)_postfix)$/).test(key)) + if ( + "string" === typeof key && + RegExp(/(.*)_postfix$/).test(key) + ) return "string" === typeof value; if ( + "string" === typeof key && RegExp( - /^(value_[+-]?\d+(?:\.\d+)?(?:[eE][+-]?\d+)?)$/, + /^value_[+-]?\d+(?:\.\d+)?(?:[eE][+-]?\d+)?$/, ).test(key) ) return ( @@ -245,8 +264,9 @@ export const test_notation_validateCamel_DynamicTemplate = Number.isFinite(value) ); if ( + "string" === typeof key && RegExp( - /^(between_(.*)_and_[+-]?\d+(?:\.\d+)?(?:[eE][+-]?\d+)?)$/, + /^between_(.*)_and_[+-]?\d+(?:\.\d+)?(?:[eE][+-]?\d+)?$/, ).test(key) ) return "boolean" === typeof value; @@ -276,7 +296,10 @@ export const test_notation_validateCamel_DynamicTemplate = Object.keys(input).every((key: any) => { const value = input[key]; if (undefined === value) return true; - if (RegExp(/^(prefix_(.*))/).test(key)) + if ( + "string" === typeof key && + RegExp(/^prefix_(.*)/).test(key) + ) return ( "string" === typeof value || $guard(_exceptionable, { @@ -285,7 +308,10 @@ export const test_notation_validateCamel_DynamicTemplate = value: value, }) ); - if (RegExp(/((.*)_postfix)$/).test(key)) + if ( + "string" === typeof key && + RegExp(/(.*)_postfix$/).test(key) + ) return ( "string" === typeof value || $guard(_exceptionable, { @@ -295,8 +321,9 @@ export const test_notation_validateCamel_DynamicTemplate = }) ); if ( + "string" === typeof key && RegExp( - /^(value_[+-]?\d+(?:\.\d+)?(?:[eE][+-]?\d+)?)$/, + /^value_[+-]?\d+(?:\.\d+)?(?:[eE][+-]?\d+)?$/, ).test(key) ) return ( @@ -309,8 +336,9 @@ export const test_notation_validateCamel_DynamicTemplate = }) ); if ( + "string" === typeof key && RegExp( - /^(between_(.*)_and_[+-]?\d+(?:\.\d+)?(?:[eE][+-]?\d+)?)$/, + /^between_(.*)_and_[+-]?\d+(?:\.\d+)?(?:[eE][+-]?\d+)?$/, ).test(key) ) return ( diff --git a/test/generated/output/notation.camel/test_notation_camel_DynamicTree.ts b/test/generated/output/notation.camel/test_notation_camel_DynamicTree.ts index 2360ef2765..ef9a7d085d 100644 --- a/test/generated/output/notation.camel/test_notation_camel_DynamicTree.ts +++ b/test/generated/output/notation.camel/test_notation_camel_DynamicTree.ts @@ -25,7 +25,7 @@ export const test_notation_validateCamel_DynamicTree = Object.keys(input).every((key: any) => { const value = input[key]; if (undefined === value) return true; - if (RegExp(/(.*)/).test(key)) + if (true) return ( "object" === typeof value && null !== value && @@ -103,7 +103,7 @@ export const test_notation_validateCamel_DynamicTree = const value = input[key]; if (undefined === value) return true; - if (RegExp(/(.*)/).test(key)) + if (true) return ( ((("object" === typeof value && @@ -182,7 +182,7 @@ export const test_notation_validateCamel_DynamicTree = Object.keys(input).every((key: any) => { const value = input[key]; if (undefined === value) return true; - if (RegExp(/(.*)/).test(key)) + if (true) return ( "object" === typeof value && null !== value && @@ -236,7 +236,7 @@ export const test_notation_validateCamel_DynamicTree = Object.keys(input).every((key: any) => { const value = input[key]; if (undefined === value) return true; - if (RegExp(/(.*)/).test(key)) + if (true) return ( "object" === typeof value && null !== value && @@ -301,7 +301,7 @@ export const test_notation_validateCamel_DynamicTree = Object.keys(input).every((key: any) => { const value = input[key]; if (undefined === value) return true; - if (RegExp(/(.*)/).test(key)) + if (true) return ( ((("object" === typeof value && null !== value) || diff --git a/test/generated/output/notation.camel/test_notation_camel_DynamicUndefined.ts b/test/generated/output/notation.camel/test_notation_camel_DynamicUndefined.ts index 308c8b9e20..0041902fcb 100644 --- a/test/generated/output/notation.camel/test_notation_camel_DynamicUndefined.ts +++ b/test/generated/output/notation.camel/test_notation_camel_DynamicUndefined.ts @@ -19,7 +19,7 @@ export const test_notation_validateCamel_DynamicUndefined = Object.keys(input).every((key: any) => { const value = input[key]; if (undefined === value) return true; - if (RegExp(/(.*)/).test(key)) + if (true) return ( null !== value && undefined === value ); @@ -55,7 +55,7 @@ export const test_notation_validateCamel_DynamicUndefined = const value = input[key]; if (undefined === value) return true; - if (RegExp(/(.*)/).test(key)) + if (true) return ( (null !== value || $report( @@ -144,8 +144,7 @@ export const test_notation_validateCamel_DynamicUndefined = Object.keys(input).every((key: any) => { const value = input[key]; if (undefined === value) return true; - if (RegExp(/(.*)/).test(key)) - return null !== value && undefined === value; + if (true) return null !== value && undefined === value; return true; }); return ( @@ -172,7 +171,7 @@ export const test_notation_validateCamel_DynamicUndefined = Object.keys(input).every((key: any) => { const value = input[key]; if (undefined === value) return true; - if (RegExp(/(.*)/).test(key)) + if (true) return ( (null !== value || $guard(_exceptionable, { diff --git a/test/generated/output/notation.camel/test_notation_camel_DynamicUnion.ts b/test/generated/output/notation.camel/test_notation_camel_DynamicUnion.ts index be2fe4ab7a..4d64f73d46 100644 --- a/test/generated/output/notation.camel/test_notation_camel_DynamicUnion.ts +++ b/test/generated/output/notation.camel/test_notation_camel_DynamicUnion.ts @@ -18,18 +18,24 @@ export const test_notation_validateCamel_DynamicUnion = const value = input[key]; if (undefined === value) return true; if ( - RegExp( - /^[+-]?\d+(?:\.\d+)?(?:[eE][+-]?\d+)?$/, - ).test(key) + "number" === typeof Number(key) && + Number.isFinite(Number(key)) ) return "string" === typeof value; - if (RegExp(/^(prefix_(.*))/).test(key)) + if ( + "string" === typeof key && + RegExp(/^prefix_(.*)/).test(key) + ) return "string" === typeof value; - if (RegExp(/((.*)_postfix)$/).test(key)) + if ( + "string" === typeof key && + RegExp(/(.*)_postfix$/).test(key) + ) return "string" === typeof value; if ( + "string" === typeof key && RegExp( - /^(value_between_[+-]?\d+(?:\.\d+)?(?:[eE][+-]?\d+)?_and_[+-]?\d+(?:\.\d+)?(?:[eE][+-]?\d+)?)$/, + /^value_between_[+-]?\d+(?:\.\d+)?(?:[eE][+-]?\d+)?_and_[+-]?\d+(?:\.\d+)?(?:[eE][+-]?\d+)?$/, ).test(key) ) return ( @@ -69,9 +75,9 @@ export const test_notation_validateCamel_DynamicUnion = if (undefined === value) return true; if ( - RegExp( - /^[+-]?\d+(?:\.\d+)?(?:[eE][+-]?\d+)?$/, - ).test(key) + "number" === + typeof Number(key) && + Number.isFinite(Number(key)) ) return ( "string" === @@ -89,9 +95,10 @@ export const test_notation_validateCamel_DynamicUnion = ) ); if ( - RegExp( - /^(prefix_(.*))/, - ).test(key) + "string" === typeof key && + RegExp(/^prefix_(.*)/).test( + key, + ) ) return ( "string" === @@ -109,8 +116,9 @@ export const test_notation_validateCamel_DynamicUnion = ) ); if ( + "string" === typeof key && RegExp( - /((.*)_postfix)$/, + /(.*)_postfix$/, ).test(key) ) return ( @@ -129,8 +137,9 @@ export const test_notation_validateCamel_DynamicUnion = ) ); if ( + "string" === typeof key && RegExp( - /^(value_between_[+-]?\d+(?:\.\d+)?(?:[eE][+-]?\d+)?_and_[+-]?\d+(?:\.\d+)?(?:[eE][+-]?\d+)?)$/, + /^value_between_[+-]?\d+(?:\.\d+)?(?:[eE][+-]?\d+)?_and_[+-]?\d+(?:\.\d+)?(?:[eE][+-]?\d+)?$/, ).test(key) ) return ( @@ -230,18 +239,24 @@ export const test_notation_validateCamel_DynamicUnion = const value = input[key]; if (undefined === value) return true; if ( - RegExp( - /^[+-]?\d+(?:\.\d+)?(?:[eE][+-]?\d+)?$/, - ).test(key) + "number" === typeof Number(key) && + Number.isFinite(Number(key)) ) return "string" === typeof value; - if (RegExp(/^(prefix_(.*))/).test(key)) + if ( + "string" === typeof key && + RegExp(/^prefix_(.*)/).test(key) + ) return "string" === typeof value; - if (RegExp(/((.*)_postfix)$/).test(key)) + if ( + "string" === typeof key && + RegExp(/(.*)_postfix$/).test(key) + ) return "string" === typeof value; if ( + "string" === typeof key && RegExp( - /^(value_between_[+-]?\d+(?:\.\d+)?(?:[eE][+-]?\d+)?_and_[+-]?\d+(?:\.\d+)?(?:[eE][+-]?\d+)?)$/, + /^value_between_[+-]?\d+(?:\.\d+)?(?:[eE][+-]?\d+)?_and_[+-]?\d+(?:\.\d+)?(?:[eE][+-]?\d+)?$/, ).test(key) ) return ( @@ -275,9 +290,8 @@ export const test_notation_validateCamel_DynamicUnion = const value = input[key]; if (undefined === value) return true; if ( - RegExp( - /^[+-]?\d+(?:\.\d+)?(?:[eE][+-]?\d+)?$/, - ).test(key) + "number" === typeof Number(key) && + Number.isFinite(Number(key)) ) return ( "string" === typeof value || @@ -287,7 +301,10 @@ export const test_notation_validateCamel_DynamicUnion = value: value, }) ); - if (RegExp(/^(prefix_(.*))/).test(key)) + if ( + "string" === typeof key && + RegExp(/^prefix_(.*)/).test(key) + ) return ( "string" === typeof value || $guard(_exceptionable, { @@ -296,7 +313,10 @@ export const test_notation_validateCamel_DynamicUnion = value: value, }) ); - if (RegExp(/((.*)_postfix)$/).test(key)) + if ( + "string" === typeof key && + RegExp(/(.*)_postfix$/).test(key) + ) return ( "string" === typeof value || $guard(_exceptionable, { @@ -306,8 +326,9 @@ export const test_notation_validateCamel_DynamicUnion = }) ); if ( + "string" === typeof key && RegExp( - /^(value_between_[+-]?\d+(?:\.\d+)?(?:[eE][+-]?\d+)?_and_[+-]?\d+(?:\.\d+)?(?:[eE][+-]?\d+)?)$/, + /^value_between_[+-]?\d+(?:\.\d+)?(?:[eE][+-]?\d+)?_and_[+-]?\d+(?:\.\d+)?(?:[eE][+-]?\d+)?$/, ).test(key) ) return ( diff --git a/test/generated/output/notation.camel/test_notation_camel_ObjectDynamic.ts b/test/generated/output/notation.camel/test_notation_camel_ObjectDynamic.ts index 0fb1308c95..3d6fad8f92 100644 --- a/test/generated/output/notation.camel/test_notation_camel_ObjectDynamic.ts +++ b/test/generated/output/notation.camel/test_notation_camel_ObjectDynamic.ts @@ -19,7 +19,7 @@ export const test_notation_validateCamel_ObjectDynamic = Object.keys(input).every((key: any) => { const value = input[key]; if (undefined === value) return true; - if (RegExp(/(.*)/).test(key)) + if (true) return ( "string" === typeof value || ("number" === typeof value && @@ -58,7 +58,7 @@ export const test_notation_validateCamel_ObjectDynamic = const value = input[key]; if (undefined === value) return true; - if (RegExp(/(.*)/).test(key)) + if (true) return ( "string" === typeof value || @@ -139,7 +139,7 @@ export const test_notation_validateCamel_ObjectDynamic = Object.keys(input).every((key: any) => { const value = input[key]; if (undefined === value) return true; - if (RegExp(/(.*)/).test(key)) + if (true) return ( "string" === typeof value || ("number" === typeof value && @@ -172,7 +172,7 @@ export const test_notation_validateCamel_ObjectDynamic = Object.keys(input).every((key: any) => { const value = input[key]; if (undefined === value) return true; - if (RegExp(/(.*)/).test(key)) + if (true) return ( "string" === typeof value || ("number" === typeof value && diff --git a/test/generated/output/notation.camel/test_notation_camel_UltimateUnion.ts b/test/generated/output/notation.camel/test_notation_camel_UltimateUnion.ts index 27e34c889c..d703b7bc65 100644 --- a/test/generated/output/notation.camel/test_notation_camel_UltimateUnion.ts +++ b/test/generated/output/notation.camel/test_notation_camel_UltimateUnion.ts @@ -561,7 +561,7 @@ export const test_notation_validateCamel_UltimateUnion = Object.keys(input).every((key: any) => { const value = input[key]; if (undefined === value) return true; - if (RegExp(/(.*)/).test(key)) + if (true) return ( "object" === typeof value && null !== value && @@ -645,7 +645,7 @@ export const test_notation_validateCamel_UltimateUnion = Object.keys(input).every((key: any) => { const value = input[key]; if (undefined === value) return true; - if (RegExp(/(.*)/).test(key)) + if (true) return ( "object" === typeof value && null !== value && @@ -4169,7 +4169,7 @@ export const test_notation_validateCamel_UltimateUnion = const value = input[key]; if (undefined === value) return true; - if (RegExp(/(.*)/).test(key)) + if (true) return ( ((("object" === typeof value && @@ -4533,7 +4533,7 @@ export const test_notation_validateCamel_UltimateUnion = const value = input[key]; if (undefined === value) return true; - if (RegExp(/(.*)/).test(key)) + if (true) return ( ((("object" === typeof value && @@ -8093,7 +8093,7 @@ export const test_notation_validateCamel_UltimateUnion = Object.keys(input).every((key: any) => { const value = input[key]; if (undefined === value) return true; - if (RegExp(/(.*)/).test(key)) + if (true) return ( "object" === typeof value && null !== value && @@ -8162,7 +8162,7 @@ export const test_notation_validateCamel_UltimateUnion = Object.keys(input).every((key: any) => { const value = input[key]; if (undefined === value) return true; - if (RegExp(/(.*)/).test(key)) + if (true) return ( "object" === typeof value && null !== value && @@ -10050,7 +10050,7 @@ export const test_notation_validateCamel_UltimateUnion = Object.keys(input).every((key: any) => { const value = input[key]; if (undefined === value) return true; - if (RegExp(/(.*)/).test(key)) + if (true) return ( "object" === typeof value && null !== value && @@ -10117,7 +10117,7 @@ export const test_notation_validateCamel_UltimateUnion = Object.keys(input).every((key: any) => { const value = input[key]; if (undefined === value) return true; - if (RegExp(/(.*)/).test(key)) + if (true) return ( "object" === typeof value && null !== value && @@ -12925,7 +12925,7 @@ export const test_notation_validateCamel_UltimateUnion = Object.keys(input).every((key: any) => { const value = input[key]; if (undefined === value) return true; - if (RegExp(/(.*)/).test(key)) + if (true) return ( ((("object" === typeof value && null !== value && @@ -13181,7 +13181,7 @@ export const test_notation_validateCamel_UltimateUnion = Object.keys(input).every((key: any) => { const value = input[key]; if (undefined === value) return true; - if (RegExp(/(.*)/).test(key)) + if (true) return ( ((("object" === typeof value && null !== value && diff --git a/test/generated/output/notation.createCamel/test_notation_createCamel_DynamicComposite.ts b/test/generated/output/notation.createCamel/test_notation_createCamel_DynamicComposite.ts index 7136ec18fc..543bf199dd 100644 --- a/test/generated/output/notation.createCamel/test_notation_createCamel_DynamicComposite.ts +++ b/test/generated/output/notation.createCamel/test_notation_createCamel_DynamicComposite.ts @@ -25,21 +25,27 @@ export const test_notation_createValidateCamel_DynamicComposite = const value = input[key]; if (undefined === value) return true; if ( - RegExp( - /^[+-]?\d+(?:\.\d+)?(?:[eE][+-]?\d+)?$/, - ).test(key) + "number" === typeof Number(key) && + Number.isFinite(Number(key)) ) return ( "number" === typeof value && Number.isFinite(value) ); - if (RegExp(/^(prefix_(.*))/).test(key)) + if ( + "string" === typeof key && + RegExp(/^prefix_(.*)/).test(key) + ) return "string" === typeof value; - if (RegExp(/((.*)_postfix)$/).test(key)) + if ( + "string" === typeof key && + RegExp(/(.*)_postfix$/).test(key) + ) return "string" === typeof value; if ( + "string" === typeof key && RegExp( - /^(value_[+-]?\d+(?:\.\d+)?(?:[eE][+-]?\d+)?)$/, + /^value_[+-]?\d+(?:\.\d+)?(?:[eE][+-]?\d+)?$/, ).test(key) ) return ( @@ -49,8 +55,9 @@ export const test_notation_createValidateCamel_DynamicComposite = "boolean" === typeof value ); if ( + "string" === typeof key && RegExp( - /^(between_(.*)_and_[+-]?\d+(?:\.\d+)?(?:[eE][+-]?\d+)?)$/, + /^between_(.*)_and_[+-]?\d+(?:\.\d+)?(?:[eE][+-]?\d+)?$/, ).test(key) ) return "boolean" === typeof value; @@ -105,9 +112,9 @@ export const test_notation_createValidateCamel_DynamicComposite = if (undefined === value) return true; if ( - RegExp( - /^[+-]?\d+(?:\.\d+)?(?:[eE][+-]?\d+)?$/, - ).test(key) + "number" === + typeof Number(key) && + Number.isFinite(Number(key)) ) return ( ("number" === @@ -123,9 +130,8 @@ export const test_notation_createValidateCamel_DynamicComposite = }) ); if ( - RegExp(/^(prefix_(.*))/).test( - key, - ) + "string" === typeof key && + RegExp(/^prefix_(.*)/).test(key) ) return ( "string" === typeof value || @@ -137,7 +143,8 @@ export const test_notation_createValidateCamel_DynamicComposite = }) ); if ( - RegExp(/((.*)_postfix)$/).test( + "string" === typeof key && + RegExp(/(.*)_postfix$/).test( key, ) ) @@ -151,8 +158,9 @@ export const test_notation_createValidateCamel_DynamicComposite = }) ); if ( + "string" === typeof key && RegExp( - /^(value_[+-]?\d+(?:\.\d+)?(?:[eE][+-]?\d+)?)$/, + /^value_[+-]?\d+(?:\.\d+)?(?:[eE][+-]?\d+)?$/, ).test(key) ) return ( @@ -173,8 +181,9 @@ export const test_notation_createValidateCamel_DynamicComposite = }) ); if ( + "string" === typeof key && RegExp( - /^(between_(.*)_and_[+-]?\d+(?:\.\d+)?(?:[eE][+-]?\d+)?)$/, + /^between_(.*)_and_[+-]?\d+(?:\.\d+)?(?:[eE][+-]?\d+)?$/, ).test(key) ) return ( @@ -285,21 +294,27 @@ export const test_notation_createValidateCamel_DynamicComposite = const value = input[key]; if (undefined === value) return true; if ( - RegExp( - /^[+-]?\d+(?:\.\d+)?(?:[eE][+-]?\d+)?$/, - ).test(key) + "number" === typeof Number(key) && + Number.isFinite(Number(key)) ) return ( "number" === typeof value && Number.isFinite(value) ); - if (RegExp(/^(prefix_(.*))/).test(key)) + if ( + "string" === typeof key && + RegExp(/^prefix_(.*)/).test(key) + ) return "string" === typeof value; - if (RegExp(/((.*)_postfix)$/).test(key)) + if ( + "string" === typeof key && + RegExp(/(.*)_postfix$/).test(key) + ) return "string" === typeof value; if ( + "string" === typeof key && RegExp( - /^(value_[+-]?\d+(?:\.\d+)?(?:[eE][+-]?\d+)?)$/, + /^value_[+-]?\d+(?:\.\d+)?(?:[eE][+-]?\d+)?$/, ).test(key) ) return ( @@ -309,8 +324,9 @@ export const test_notation_createValidateCamel_DynamicComposite = "boolean" === typeof value ); if ( + "string" === typeof key && RegExp( - /^(between_(.*)_and_[+-]?\d+(?:\.\d+)?(?:[eE][+-]?\d+)?)$/, + /^between_(.*)_and_[+-]?\d+(?:\.\d+)?(?:[eE][+-]?\d+)?$/, ).test(key) ) return "boolean" === typeof value; @@ -356,9 +372,8 @@ export const test_notation_createValidateCamel_DynamicComposite = const value = input[key]; if (undefined === value) return true; if ( - RegExp( - /^[+-]?\d+(?:\.\d+)?(?:[eE][+-]?\d+)?$/, - ).test(key) + "number" === typeof Number(key) && + Number.isFinite(Number(key)) ) return ( ("number" === typeof value && @@ -369,7 +384,10 @@ export const test_notation_createValidateCamel_DynamicComposite = value: value, }) ); - if (RegExp(/^(prefix_(.*))/).test(key)) + if ( + "string" === typeof key && + RegExp(/^prefix_(.*)/).test(key) + ) return ( "string" === typeof value || $guard(_exceptionable, { @@ -378,7 +396,10 @@ export const test_notation_createValidateCamel_DynamicComposite = value: value, }) ); - if (RegExp(/((.*)_postfix)$/).test(key)) + if ( + "string" === typeof key && + RegExp(/(.*)_postfix$/).test(key) + ) return ( "string" === typeof value || $guard(_exceptionable, { @@ -388,8 +409,9 @@ export const test_notation_createValidateCamel_DynamicComposite = }) ); if ( + "string" === typeof key && RegExp( - /^(value_[+-]?\d+(?:\.\d+)?(?:[eE][+-]?\d+)?)$/, + /^value_[+-]?\d+(?:\.\d+)?(?:[eE][+-]?\d+)?$/, ).test(key) ) return ( @@ -405,8 +427,9 @@ export const test_notation_createValidateCamel_DynamicComposite = }) ); if ( + "string" === typeof key && RegExp( - /^(between_(.*)_and_[+-]?\d+(?:\.\d+)?(?:[eE][+-]?\d+)?)$/, + /^between_(.*)_and_[+-]?\d+(?:\.\d+)?(?:[eE][+-]?\d+)?$/, ).test(key) ) return ( diff --git a/test/generated/output/notation.createCamel/test_notation_createCamel_DynamicNever.ts b/test/generated/output/notation.createCamel/test_notation_createCamel_DynamicNever.ts index 90ed269b49..557e7ee3a4 100644 --- a/test/generated/output/notation.createCamel/test_notation_createCamel_DynamicNever.ts +++ b/test/generated/output/notation.createCamel/test_notation_createCamel_DynamicNever.ts @@ -16,7 +16,7 @@ export const test_notation_createValidateCamel_DynamicNever = Object.keys(input).every((key: any) => { const value = input[key]; if (undefined === value) return true; - if (RegExp(/(.*)/).test(key)) + if (true) return null !== value && undefined === value; return true; }); @@ -51,7 +51,7 @@ export const test_notation_createValidateCamel_DynamicNever = const value = input[key]; if (undefined === value) return true; - if (RegExp(/(.*)/).test(key)) + if (true) return ( (null !== value || $report( @@ -136,8 +136,7 @@ export const test_notation_createValidateCamel_DynamicNever = Object.keys(input).every((key: any) => { const value = input[key]; if (undefined === value) return true; - if (RegExp(/(.*)/).test(key)) - return null !== value && undefined === value; + if (true) return null !== value && undefined === value; return true; }); return ( @@ -164,7 +163,7 @@ export const test_notation_createValidateCamel_DynamicNever = Object.keys(input).every((key: any) => { const value = input[key]; if (undefined === value) return true; - if (RegExp(/(.*)/).test(key)) + if (true) return ( (null !== value || $guard(_exceptionable, { diff --git a/test/generated/output/notation.createCamel/test_notation_createCamel_DynamicTag.ts b/test/generated/output/notation.createCamel/test_notation_createCamel_DynamicTag.ts new file mode 100644 index 0000000000..df621356f4 --- /dev/null +++ b/test/generated/output/notation.createCamel/test_notation_createCamel_DynamicTag.ts @@ -0,0 +1,311 @@ +import typia from "../../../../src"; +import { _test_notation_validateGeneral } from "../../../internal/_test_notation_validateGeneral"; +import { DynamicTag } from "../../../structures/DynamicTag"; + +export const test_notation_createValidateCamel_DynamicTag = + _test_notation_validateGeneral("DynamicTag")(DynamicTag)< + typia.CamelCase + >({ + convert: ( + input: any, + ): typia.IValidation> => { + const validate = (input: any): typia.IValidation => { + const errors = [] as any[]; + const __is = (input: any): input is DynamicTag => { + const $io0 = (input: any): boolean => + Object.keys(input).every((key: any) => { + const value = input[key]; + if (undefined === value) return true; + if ( + "number" === typeof Number(key) && + 0 <= Number(key) && + Number(key) < 10 + ) + return ( + "bigint" === typeof value && + BigInt(0) <= value + ); + if ( + "string" === typeof key && + /^(?:[0-9a-f]{8}-[0-9a-f]{4}-[1-5][0-9a-f]{3}-[89ab][0-9a-f]{3}-[0-9a-f]{12}|00000000-0000-0000-0000-000000000000)$/i.test( + key, + ) + ) + return ( + "string" === typeof value && + /^(([^<>()[\]\.,;:\s@\"]+(\.[^<>()[\]\.,;:\s@\"]+)*)|(\".+\"))@(([^<>()[\]\.,;:\s@\"]+\.)+[^<>()[\]\.,;:\s@\"]{2,})$/i.test( + value, + ) + ); + return true; + }); + return ( + "object" === typeof input && + null !== input && + false === Array.isArray(input) && + $io0(input) + ); + }; + if (false === __is(input)) { + const $report = ( + typia.notations.createValidateCamel as any + ).report(errors); + (( + input: any, + _path: string, + _exceptionable: boolean = true, + ): input is DynamicTag => { + const $join = ( + typia.notations.createValidateCamel as any + ).join; + const $vo0 = ( + input: any, + _path: string, + _exceptionable: boolean = true, + ): boolean => + [ + false === _exceptionable || + Object.keys(input) + .map((key: any) => { + const value = input[key]; + if (undefined === value) + return true; + if ( + "number" === + typeof Number(key) && + 0 <= Number(key) && + Number(key) < 10 + ) + return ( + ("bigint" === + typeof value && + (BigInt(0) <= value || + $report( + _exceptionable, + { + path: + _path + + $join( + key, + ), + expected: + 'bigint & Type<"uint64">', + value: value, + }, + ))) || + $report(_exceptionable, { + path: + _path + $join(key), + expected: + '(bigint & Type<"uint64">)', + value: value, + }) + ); + if ( + "string" === typeof key && + /^(?:[0-9a-f]{8}-[0-9a-f]{4}-[1-5][0-9a-f]{3}-[89ab][0-9a-f]{3}-[0-9a-f]{12}|00000000-0000-0000-0000-000000000000)$/i.test( + key, + ) + ) + return ( + ("string" === + typeof value && + (/^(([^<>()[\]\.,;:\s@\"]+(\.[^<>()[\]\.,;:\s@\"]+)*)|(\".+\"))@(([^<>()[\]\.,;:\s@\"]+\.)+[^<>()[\]\.,;:\s@\"]{2,})$/i.test( + value, + ) || + $report( + _exceptionable, + { + path: + _path + + $join( + key, + ), + expected: + 'string & Format<"email">', + value: value, + }, + ))) || + $report(_exceptionable, { + path: + _path + $join(key), + expected: + '(string & Format<"email">)', + value: value, + }) + ); + return true; + }) + .every((flag: boolean) => flag), + ].every((flag: boolean) => flag); + return ( + ((("object" === typeof input && + null !== input && + false === Array.isArray(input)) || + $report(true, { + path: _path + "", + expected: "DynamicTag", + value: input, + })) && + $vo0(input, _path + "", true)) || + $report(true, { + path: _path + "", + expected: "DynamicTag", + value: input, + }) + ); + })(input, "$input", true); + } + const success = 0 === errors.length; + return { + success, + errors, + data: success ? input : undefined, + } as any; + }; + const general = ( + input: DynamicTag, + ): typia.CamelCase => { + const $co0 = (input: any): any => { + const output = {} as any; + for (const [key, value] of Object.entries(input)) { + if ( + RegExp( + /^[+-]?\d+(?:\.\d+)?(?:[eE][+-]?\d+)?$/, + ).test(key) + ) { + output[key] = value as any; + continue; + } + if (RegExp(/(.*)/).test(key)) { + output[key] = value as any; + continue; + } + } + return output; + }; + return "object" === typeof input && null !== input + ? $co0(input) + : (input as any); + }; + const output = validate(input) as any; + if (output.success) output.data = general(input); + return output; + }, + assert: (input: any): typia.CamelCase => { + const __is = (input: any): input is typia.CamelCase => { + const $io0 = (input: any): boolean => + Object.keys(input).every((key: any) => { + const value = input[key]; + if (undefined === value) return true; + if ( + "number" === typeof Number(key) && + 0 <= Number(key) && + Number(key) < 10 + ) + return ( + "bigint" === typeof value && BigInt(0) <= value + ); + if ( + "string" === typeof key && + /^(?:[0-9a-f]{8}-[0-9a-f]{4}-[1-5][0-9a-f]{3}-[89ab][0-9a-f]{3}-[0-9a-f]{12}|00000000-0000-0000-0000-000000000000)$/i.test( + key, + ) + ) + return ( + "string" === typeof value && + /^(([^<>()[\]\.,;:\s@\"]+(\.[^<>()[\]\.,;:\s@\"]+)*)|(\".+\"))@(([^<>()[\]\.,;:\s@\"]+\.)+[^<>()[\]\.,;:\s@\"]{2,})$/i.test( + value, + ) + ); + return true; + }); + return ( + "object" === typeof input && + null !== input && + false === Array.isArray(input) && + $io0(input) + ); + }; + if (false === __is(input)) + (( + input: any, + _path: string, + _exceptionable: boolean = true, + ): input is typia.CamelCase => { + const $guard = (typia.createAssert as any).guard; + const $join = (typia.createAssert as any).join; + const $ao0 = ( + input: any, + _path: string, + _exceptionable: boolean = true, + ): boolean => + false === _exceptionable || + Object.keys(input).every((key: any) => { + const value = input[key]; + if (undefined === value) return true; + if ( + "number" === typeof Number(key) && + 0 <= Number(key) && + Number(key) < 10 + ) + return ( + ("bigint" === typeof value && + (BigInt(0) <= value || + $guard(_exceptionable, { + path: _path + $join(key), + expected: + 'bigint & Type<"uint64">', + value: value, + }))) || + $guard(_exceptionable, { + path: _path + $join(key), + expected: '(bigint & Type<"uint64">)', + value: value, + }) + ); + if ( + "string" === typeof key && + /^(?:[0-9a-f]{8}-[0-9a-f]{4}-[1-5][0-9a-f]{3}-[89ab][0-9a-f]{3}-[0-9a-f]{12}|00000000-0000-0000-0000-000000000000)$/i.test( + key, + ) + ) + return ( + ("string" === typeof value && + (/^(([^<>()[\]\.,;:\s@\"]+(\.[^<>()[\]\.,;:\s@\"]+)*)|(\".+\"))@(([^<>()[\]\.,;:\s@\"]+\.)+[^<>()[\]\.,;:\s@\"]{2,})$/i.test( + value, + ) || + $guard(_exceptionable, { + path: _path + $join(key), + expected: + 'string & Format<"email">', + value: value, + }))) || + $guard(_exceptionable, { + path: _path + $join(key), + expected: '(string & Format<"email">)', + value: value, + }) + ); + return true; + }); + return ( + ((("object" === typeof input && + null !== input && + false === Array.isArray(input)) || + $guard(true, { + path: _path + "", + expected: "DynamicTag", + value: input, + })) && + $ao0(input, _path + "", true)) || + $guard(true, { + path: _path + "", + expected: "DynamicTag", + value: input, + }) + ); + })(input, "$input", true); + return input; + }, + }); diff --git a/test/generated/output/notation.createCamel/test_notation_createCamel_DynamicTemplate.ts b/test/generated/output/notation.createCamel/test_notation_createCamel_DynamicTemplate.ts index 225da57e09..3f75749ab3 100644 --- a/test/generated/output/notation.createCamel/test_notation_createCamel_DynamicTemplate.ts +++ b/test/generated/output/notation.createCamel/test_notation_createCamel_DynamicTemplate.ts @@ -18,13 +18,20 @@ export const test_notation_createValidateCamel_DynamicTemplate = Object.keys(input).every((key: any) => { const value = input[key]; if (undefined === value) return true; - if (RegExp(/^(prefix_(.*))/).test(key)) + if ( + "string" === typeof key && + RegExp(/^prefix_(.*)/).test(key) + ) return "string" === typeof value; - if (RegExp(/((.*)_postfix)$/).test(key)) + if ( + "string" === typeof key && + RegExp(/(.*)_postfix$/).test(key) + ) return "string" === typeof value; if ( + "string" === typeof key && RegExp( - /^(value_[+-]?\d+(?:\.\d+)?(?:[eE][+-]?\d+)?)$/, + /^value_[+-]?\d+(?:\.\d+)?(?:[eE][+-]?\d+)?$/, ).test(key) ) return ( @@ -32,8 +39,9 @@ export const test_notation_createValidateCamel_DynamicTemplate = Number.isFinite(value) ); if ( + "string" === typeof key && RegExp( - /^(between_(.*)_and_[+-]?\d+(?:\.\d+)?(?:[eE][+-]?\d+)?)$/, + /^between_(.*)_and_[+-]?\d+(?:\.\d+)?(?:[eE][+-]?\d+)?$/, ).test(key) ) return "boolean" === typeof value; @@ -71,9 +79,8 @@ export const test_notation_createValidateCamel_DynamicTemplate = if (undefined === value) return true; if ( - RegExp(/^(prefix_(.*))/).test( - key, - ) + "string" === typeof key && + RegExp(/^prefix_(.*)/).test(key) ) return ( "string" === typeof value || @@ -85,7 +92,8 @@ export const test_notation_createValidateCamel_DynamicTemplate = }) ); if ( - RegExp(/((.*)_postfix)$/).test( + "string" === typeof key && + RegExp(/(.*)_postfix$/).test( key, ) ) @@ -99,8 +107,9 @@ export const test_notation_createValidateCamel_DynamicTemplate = }) ); if ( + "string" === typeof key && RegExp( - /^(value_[+-]?\d+(?:\.\d+)?(?:[eE][+-]?\d+)?)$/, + /^value_[+-]?\d+(?:\.\d+)?(?:[eE][+-]?\d+)?$/, ).test(key) ) return ( @@ -117,8 +126,9 @@ export const test_notation_createValidateCamel_DynamicTemplate = }) ); if ( + "string" === typeof key && RegExp( - /^(between_(.*)_and_[+-]?\d+(?:\.\d+)?(?:[eE][+-]?\d+)?)$/, + /^between_(.*)_and_[+-]?\d+(?:\.\d+)?(?:[eE][+-]?\d+)?$/, ).test(key) ) return ( @@ -209,13 +219,20 @@ export const test_notation_createValidateCamel_DynamicTemplate = Object.keys(input).every((key: any) => { const value = input[key]; if (undefined === value) return true; - if (RegExp(/^(prefix_(.*))/).test(key)) + if ( + "string" === typeof key && + RegExp(/^prefix_(.*)/).test(key) + ) return "string" === typeof value; - if (RegExp(/((.*)_postfix)$/).test(key)) + if ( + "string" === typeof key && + RegExp(/(.*)_postfix$/).test(key) + ) return "string" === typeof value; if ( + "string" === typeof key && RegExp( - /^(value_[+-]?\d+(?:\.\d+)?(?:[eE][+-]?\d+)?)$/, + /^value_[+-]?\d+(?:\.\d+)?(?:[eE][+-]?\d+)?$/, ).test(key) ) return ( @@ -223,8 +240,9 @@ export const test_notation_createValidateCamel_DynamicTemplate = Number.isFinite(value) ); if ( + "string" === typeof key && RegExp( - /^(between_(.*)_and_[+-]?\d+(?:\.\d+)?(?:[eE][+-]?\d+)?)$/, + /^between_(.*)_and_[+-]?\d+(?:\.\d+)?(?:[eE][+-]?\d+)?$/, ).test(key) ) return "boolean" === typeof value; @@ -254,7 +272,10 @@ export const test_notation_createValidateCamel_DynamicTemplate = Object.keys(input).every((key: any) => { const value = input[key]; if (undefined === value) return true; - if (RegExp(/^(prefix_(.*))/).test(key)) + if ( + "string" === typeof key && + RegExp(/^prefix_(.*)/).test(key) + ) return ( "string" === typeof value || $guard(_exceptionable, { @@ -263,7 +284,10 @@ export const test_notation_createValidateCamel_DynamicTemplate = value: value, }) ); - if (RegExp(/((.*)_postfix)$/).test(key)) + if ( + "string" === typeof key && + RegExp(/(.*)_postfix$/).test(key) + ) return ( "string" === typeof value || $guard(_exceptionable, { @@ -273,8 +297,9 @@ export const test_notation_createValidateCamel_DynamicTemplate = }) ); if ( + "string" === typeof key && RegExp( - /^(value_[+-]?\d+(?:\.\d+)?(?:[eE][+-]?\d+)?)$/, + /^value_[+-]?\d+(?:\.\d+)?(?:[eE][+-]?\d+)?$/, ).test(key) ) return ( @@ -287,8 +312,9 @@ export const test_notation_createValidateCamel_DynamicTemplate = }) ); if ( + "string" === typeof key && RegExp( - /^(between_(.*)_and_[+-]?\d+(?:\.\d+)?(?:[eE][+-]?\d+)?)$/, + /^between_(.*)_and_[+-]?\d+(?:\.\d+)?(?:[eE][+-]?\d+)?$/, ).test(key) ) return ( diff --git a/test/generated/output/notation.createCamel/test_notation_createCamel_DynamicTree.ts b/test/generated/output/notation.createCamel/test_notation_createCamel_DynamicTree.ts index 5618b6feac..07ebd8a5b0 100644 --- a/test/generated/output/notation.createCamel/test_notation_createCamel_DynamicTree.ts +++ b/test/generated/output/notation.createCamel/test_notation_createCamel_DynamicTree.ts @@ -24,7 +24,7 @@ export const test_notation_createValidateCamel_DynamicTree = Object.keys(input).every((key: any) => { const value = input[key]; if (undefined === value) return true; - if (RegExp(/(.*)/).test(key)) + if (true) return ( "object" === typeof value && null !== value && @@ -100,7 +100,7 @@ export const test_notation_createValidateCamel_DynamicTree = const value = input[key]; if (undefined === value) return true; - if (RegExp(/(.*)/).test(key)) + if (true) return ( ((("object" === typeof value && @@ -170,7 +170,7 @@ export const test_notation_createValidateCamel_DynamicTree = Object.keys(input).every((key: any) => { const value = input[key]; if (undefined === value) return true; - if (RegExp(/(.*)/).test(key)) + if (true) return ( "object" === typeof value && null !== value && @@ -224,7 +224,7 @@ export const test_notation_createValidateCamel_DynamicTree = Object.keys(input).every((key: any) => { const value = input[key]; if (undefined === value) return true; - if (RegExp(/(.*)/).test(key)) + if (true) return ( "object" === typeof value && null !== value && @@ -289,7 +289,7 @@ export const test_notation_createValidateCamel_DynamicTree = Object.keys(input).every((key: any) => { const value = input[key]; if (undefined === value) return true; - if (RegExp(/(.*)/).test(key)) + if (true) return ( ((("object" === typeof value && null !== value) || diff --git a/test/generated/output/notation.createCamel/test_notation_createCamel_DynamicUndefined.ts b/test/generated/output/notation.createCamel/test_notation_createCamel_DynamicUndefined.ts index 056a87b427..b99e7b25c0 100644 --- a/test/generated/output/notation.createCamel/test_notation_createCamel_DynamicUndefined.ts +++ b/test/generated/output/notation.createCamel/test_notation_createCamel_DynamicUndefined.ts @@ -18,7 +18,7 @@ export const test_notation_createValidateCamel_DynamicUndefined = Object.keys(input).every((key: any) => { const value = input[key]; if (undefined === value) return true; - if (RegExp(/(.*)/).test(key)) + if (true) return null !== value && undefined === value; return true; }); @@ -53,7 +53,7 @@ export const test_notation_createValidateCamel_DynamicUndefined = const value = input[key]; if (undefined === value) return true; - if (RegExp(/(.*)/).test(key)) + if (true) return ( (null !== value || $report( @@ -138,8 +138,7 @@ export const test_notation_createValidateCamel_DynamicUndefined = Object.keys(input).every((key: any) => { const value = input[key]; if (undefined === value) return true; - if (RegExp(/(.*)/).test(key)) - return null !== value && undefined === value; + if (true) return null !== value && undefined === value; return true; }); return ( @@ -166,7 +165,7 @@ export const test_notation_createValidateCamel_DynamicUndefined = Object.keys(input).every((key: any) => { const value = input[key]; if (undefined === value) return true; - if (RegExp(/(.*)/).test(key)) + if (true) return ( (null !== value || $guard(_exceptionable, { diff --git a/test/generated/output/notation.createCamel/test_notation_createCamel_DynamicUnion.ts b/test/generated/output/notation.createCamel/test_notation_createCamel_DynamicUnion.ts index a6372aac71..cbb7a6b39a 100644 --- a/test/generated/output/notation.createCamel/test_notation_createCamel_DynamicUnion.ts +++ b/test/generated/output/notation.createCamel/test_notation_createCamel_DynamicUnion.ts @@ -17,18 +17,24 @@ export const test_notation_createValidateCamel_DynamicUnion = const value = input[key]; if (undefined === value) return true; if ( - RegExp( - /^[+-]?\d+(?:\.\d+)?(?:[eE][+-]?\d+)?$/, - ).test(key) + "number" === typeof Number(key) && + Number.isFinite(Number(key)) ) return "string" === typeof value; - if (RegExp(/^(prefix_(.*))/).test(key)) + if ( + "string" === typeof key && + RegExp(/^prefix_(.*)/).test(key) + ) return "string" === typeof value; - if (RegExp(/((.*)_postfix)$/).test(key)) + if ( + "string" === typeof key && + RegExp(/(.*)_postfix$/).test(key) + ) return "string" === typeof value; if ( + "string" === typeof key && RegExp( - /^(value_between_[+-]?\d+(?:\.\d+)?(?:[eE][+-]?\d+)?_and_[+-]?\d+(?:\.\d+)?(?:[eE][+-]?\d+)?)$/, + /^value_between_[+-]?\d+(?:\.\d+)?(?:[eE][+-]?\d+)?_and_[+-]?\d+(?:\.\d+)?(?:[eE][+-]?\d+)?$/, ).test(key) ) return ( @@ -69,9 +75,9 @@ export const test_notation_createValidateCamel_DynamicUnion = if (undefined === value) return true; if ( - RegExp( - /^[+-]?\d+(?:\.\d+)?(?:[eE][+-]?\d+)?$/, - ).test(key) + "number" === + typeof Number(key) && + Number.isFinite(Number(key)) ) return ( "string" === typeof value || @@ -83,9 +89,8 @@ export const test_notation_createValidateCamel_DynamicUnion = }) ); if ( - RegExp(/^(prefix_(.*))/).test( - key, - ) + "string" === typeof key && + RegExp(/^prefix_(.*)/).test(key) ) return ( "string" === typeof value || @@ -97,7 +102,8 @@ export const test_notation_createValidateCamel_DynamicUnion = }) ); if ( - RegExp(/((.*)_postfix)$/).test( + "string" === typeof key && + RegExp(/(.*)_postfix$/).test( key, ) ) @@ -111,8 +117,9 @@ export const test_notation_createValidateCamel_DynamicUnion = }) ); if ( + "string" === typeof key && RegExp( - /^(value_between_[+-]?\d+(?:\.\d+)?(?:[eE][+-]?\d+)?_and_[+-]?\d+(?:\.\d+)?(?:[eE][+-]?\d+)?)$/, + /^value_between_[+-]?\d+(?:\.\d+)?(?:[eE][+-]?\d+)?_and_[+-]?\d+(?:\.\d+)?(?:[eE][+-]?\d+)?$/, ).test(key) ) return ( @@ -207,18 +214,24 @@ export const test_notation_createValidateCamel_DynamicUnion = const value = input[key]; if (undefined === value) return true; if ( - RegExp( - /^[+-]?\d+(?:\.\d+)?(?:[eE][+-]?\d+)?$/, - ).test(key) + "number" === typeof Number(key) && + Number.isFinite(Number(key)) ) return "string" === typeof value; - if (RegExp(/^(prefix_(.*))/).test(key)) + if ( + "string" === typeof key && + RegExp(/^prefix_(.*)/).test(key) + ) return "string" === typeof value; - if (RegExp(/((.*)_postfix)$/).test(key)) + if ( + "string" === typeof key && + RegExp(/(.*)_postfix$/).test(key) + ) return "string" === typeof value; if ( + "string" === typeof key && RegExp( - /^(value_between_[+-]?\d+(?:\.\d+)?(?:[eE][+-]?\d+)?_and_[+-]?\d+(?:\.\d+)?(?:[eE][+-]?\d+)?)$/, + /^value_between_[+-]?\d+(?:\.\d+)?(?:[eE][+-]?\d+)?_and_[+-]?\d+(?:\.\d+)?(?:[eE][+-]?\d+)?$/, ).test(key) ) return ( @@ -252,9 +265,8 @@ export const test_notation_createValidateCamel_DynamicUnion = const value = input[key]; if (undefined === value) return true; if ( - RegExp( - /^[+-]?\d+(?:\.\d+)?(?:[eE][+-]?\d+)?$/, - ).test(key) + "number" === typeof Number(key) && + Number.isFinite(Number(key)) ) return ( "string" === typeof value || @@ -264,7 +276,10 @@ export const test_notation_createValidateCamel_DynamicUnion = value: value, }) ); - if (RegExp(/^(prefix_(.*))/).test(key)) + if ( + "string" === typeof key && + RegExp(/^prefix_(.*)/).test(key) + ) return ( "string" === typeof value || $guard(_exceptionable, { @@ -273,7 +288,10 @@ export const test_notation_createValidateCamel_DynamicUnion = value: value, }) ); - if (RegExp(/((.*)_postfix)$/).test(key)) + if ( + "string" === typeof key && + RegExp(/(.*)_postfix$/).test(key) + ) return ( "string" === typeof value || $guard(_exceptionable, { @@ -283,8 +301,9 @@ export const test_notation_createValidateCamel_DynamicUnion = }) ); if ( + "string" === typeof key && RegExp( - /^(value_between_[+-]?\d+(?:\.\d+)?(?:[eE][+-]?\d+)?_and_[+-]?\d+(?:\.\d+)?(?:[eE][+-]?\d+)?)$/, + /^value_between_[+-]?\d+(?:\.\d+)?(?:[eE][+-]?\d+)?_and_[+-]?\d+(?:\.\d+)?(?:[eE][+-]?\d+)?$/, ).test(key) ) return ( diff --git a/test/generated/output/notation.createCamel/test_notation_createCamel_ObjectDynamic.ts b/test/generated/output/notation.createCamel/test_notation_createCamel_ObjectDynamic.ts index 3c74adc245..83c41b5838 100644 --- a/test/generated/output/notation.createCamel/test_notation_createCamel_ObjectDynamic.ts +++ b/test/generated/output/notation.createCamel/test_notation_createCamel_ObjectDynamic.ts @@ -16,7 +16,7 @@ export const test_notation_createValidateCamel_ObjectDynamic = Object.keys(input).every((key: any) => { const value = input[key]; if (undefined === value) return true; - if (RegExp(/(.*)/).test(key)) + if (true) return ( "string" === typeof value || ("number" === typeof value && @@ -56,7 +56,7 @@ export const test_notation_createValidateCamel_ObjectDynamic = const value = input[key]; if (undefined === value) return true; - if (RegExp(/(.*)/).test(key)) + if (true) return ( "string" === typeof value || ("number" === @@ -132,7 +132,7 @@ export const test_notation_createValidateCamel_ObjectDynamic = Object.keys(input).every((key: any) => { const value = input[key]; if (undefined === value) return true; - if (RegExp(/(.*)/).test(key)) + if (true) return ( "string" === typeof value || ("number" === typeof value && @@ -165,7 +165,7 @@ export const test_notation_createValidateCamel_ObjectDynamic = Object.keys(input).every((key: any) => { const value = input[key]; if (undefined === value) return true; - if (RegExp(/(.*)/).test(key)) + if (true) return ( "string" === typeof value || ("number" === typeof value && diff --git a/test/generated/output/notation.createCamel/test_notation_createCamel_UltimateUnion.ts b/test/generated/output/notation.createCamel/test_notation_createCamel_UltimateUnion.ts index 6ae020b7b3..3d154b5200 100644 --- a/test/generated/output/notation.createCamel/test_notation_createCamel_UltimateUnion.ts +++ b/test/generated/output/notation.createCamel/test_notation_createCamel_UltimateUnion.ts @@ -527,7 +527,7 @@ export const test_notation_createValidateCamel_UltimateUnion = Object.keys(input).every((key: any) => { const value = input[key]; if (undefined === value) return true; - if (RegExp(/(.*)/).test(key)) + if (true) return ( "object" === typeof value && null !== value && @@ -596,7 +596,7 @@ export const test_notation_createValidateCamel_UltimateUnion = Object.keys(input).every((key: any) => { const value = input[key]; if (undefined === value) return true; - if (RegExp(/(.*)/).test(key)) + if (true) return ( "object" === typeof value && null !== value && @@ -3797,7 +3797,7 @@ export const test_notation_createValidateCamel_UltimateUnion = const value = input[key]; if (undefined === value) return true; - if (RegExp(/(.*)/).test(key)) + if (true) return ( ((("object" === typeof value && @@ -4122,7 +4122,7 @@ export const test_notation_createValidateCamel_UltimateUnion = const value = input[key]; if (undefined === value) return true; - if (RegExp(/(.*)/).test(key)) + if (true) return ( ((("object" === typeof value && @@ -7402,7 +7402,7 @@ export const test_notation_createValidateCamel_UltimateUnion = Object.keys(input).every((key: any) => { const value = input[key]; if (undefined === value) return true; - if (RegExp(/(.*)/).test(key)) + if (true) return ( "object" === typeof value && null !== value && @@ -7469,7 +7469,7 @@ export const test_notation_createValidateCamel_UltimateUnion = Object.keys(input).every((key: any) => { const value = input[key]; if (undefined === value) return true; - if (RegExp(/(.*)/).test(key)) + if (true) return ( "object" === typeof value && null !== value && @@ -9324,7 +9324,7 @@ export const test_notation_createValidateCamel_UltimateUnion = Object.keys(input).every((key: any) => { const value = input[key]; if (undefined === value) return true; - if (RegExp(/(.*)/).test(key)) + if (true) return ( "object" === typeof value && null !== value && @@ -9391,7 +9391,7 @@ export const test_notation_createValidateCamel_UltimateUnion = Object.keys(input).every((key: any) => { const value = input[key]; if (undefined === value) return true; - if (RegExp(/(.*)/).test(key)) + if (true) return ( "object" === typeof value && null !== value && @@ -12199,7 +12199,7 @@ export const test_notation_createValidateCamel_UltimateUnion = Object.keys(input).every((key: any) => { const value = input[key]; if (undefined === value) return true; - if (RegExp(/(.*)/).test(key)) + if (true) return ( ((("object" === typeof value && null !== value && @@ -12455,7 +12455,7 @@ export const test_notation_createValidateCamel_UltimateUnion = Object.keys(input).every((key: any) => { const value = input[key]; if (undefined === value) return true; - if (RegExp(/(.*)/).test(key)) + if (true) return ( ((("object" === typeof value && null !== value && diff --git a/test/generated/output/notation.createPascal/test_notation_createPascal_DynamicNever.ts b/test/generated/output/notation.createPascal/test_notation_createPascal_DynamicNever.ts index 569d94d235..2c2b476b7e 100644 --- a/test/generated/output/notation.createPascal/test_notation_createPascal_DynamicNever.ts +++ b/test/generated/output/notation.createPascal/test_notation_createPascal_DynamicNever.ts @@ -16,7 +16,7 @@ export const test_notation_createValidatePascal_DynamicNever = Object.keys(input).every((key: any) => { const value = input[key]; if (undefined === value) return true; - if (RegExp(/(.*)/).test(key)) + if (true) return null !== value && undefined === value; return true; }); @@ -51,7 +51,7 @@ export const test_notation_createValidatePascal_DynamicNever = const value = input[key]; if (undefined === value) return true; - if (RegExp(/(.*)/).test(key)) + if (true) return ( (null !== value || $report( @@ -136,8 +136,7 @@ export const test_notation_createValidatePascal_DynamicNever = Object.keys(input).every((key: any) => { const value = input[key]; if (undefined === value) return true; - if (RegExp(/(.*)/).test(key)) - return null !== value && undefined === value; + if (true) return null !== value && undefined === value; return true; }); return ( @@ -164,7 +163,7 @@ export const test_notation_createValidatePascal_DynamicNever = Object.keys(input).every((key: any) => { const value = input[key]; if (undefined === value) return true; - if (RegExp(/(.*)/).test(key)) + if (true) return ( (null !== value || $guard(_exceptionable, { diff --git a/test/generated/output/notation.createPascal/test_notation_createPascal_DynamicTag.ts b/test/generated/output/notation.createPascal/test_notation_createPascal_DynamicTag.ts new file mode 100644 index 0000000000..3fc624bc3c --- /dev/null +++ b/test/generated/output/notation.createPascal/test_notation_createPascal_DynamicTag.ts @@ -0,0 +1,313 @@ +import typia from "../../../../src"; +import { _test_notation_validateGeneral } from "../../../internal/_test_notation_validateGeneral"; +import { DynamicTag } from "../../../structures/DynamicTag"; + +export const test_notation_createValidatePascal_DynamicTag = + _test_notation_validateGeneral("DynamicTag")(DynamicTag)< + typia.PascalCase + >({ + convert: ( + input: any, + ): typia.IValidation> => { + const validate = (input: any): typia.IValidation => { + const errors = [] as any[]; + const __is = (input: any): input is DynamicTag => { + const $io0 = (input: any): boolean => + Object.keys(input).every((key: any) => { + const value = input[key]; + if (undefined === value) return true; + if ( + "number" === typeof Number(key) && + 0 <= Number(key) && + Number(key) < 10 + ) + return ( + "bigint" === typeof value && + BigInt(0) <= value + ); + if ( + "string" === typeof key && + /^(?:[0-9a-f]{8}-[0-9a-f]{4}-[1-5][0-9a-f]{3}-[89ab][0-9a-f]{3}-[0-9a-f]{12}|00000000-0000-0000-0000-000000000000)$/i.test( + key, + ) + ) + return ( + "string" === typeof value && + /^(([^<>()[\]\.,;:\s@\"]+(\.[^<>()[\]\.,;:\s@\"]+)*)|(\".+\"))@(([^<>()[\]\.,;:\s@\"]+\.)+[^<>()[\]\.,;:\s@\"]{2,})$/i.test( + value, + ) + ); + return true; + }); + return ( + "object" === typeof input && + null !== input && + false === Array.isArray(input) && + $io0(input) + ); + }; + if (false === __is(input)) { + const $report = ( + typia.notations.createValidatePascal as any + ).report(errors); + (( + input: any, + _path: string, + _exceptionable: boolean = true, + ): input is DynamicTag => { + const $join = ( + typia.notations.createValidatePascal as any + ).join; + const $vo0 = ( + input: any, + _path: string, + _exceptionable: boolean = true, + ): boolean => + [ + false === _exceptionable || + Object.keys(input) + .map((key: any) => { + const value = input[key]; + if (undefined === value) + return true; + if ( + "number" === + typeof Number(key) && + 0 <= Number(key) && + Number(key) < 10 + ) + return ( + ("bigint" === + typeof value && + (BigInt(0) <= value || + $report( + _exceptionable, + { + path: + _path + + $join( + key, + ), + expected: + 'bigint & Type<"uint64">', + value: value, + }, + ))) || + $report(_exceptionable, { + path: + _path + $join(key), + expected: + '(bigint & Type<"uint64">)', + value: value, + }) + ); + if ( + "string" === typeof key && + /^(?:[0-9a-f]{8}-[0-9a-f]{4}-[1-5][0-9a-f]{3}-[89ab][0-9a-f]{3}-[0-9a-f]{12}|00000000-0000-0000-0000-000000000000)$/i.test( + key, + ) + ) + return ( + ("string" === + typeof value && + (/^(([^<>()[\]\.,;:\s@\"]+(\.[^<>()[\]\.,;:\s@\"]+)*)|(\".+\"))@(([^<>()[\]\.,;:\s@\"]+\.)+[^<>()[\]\.,;:\s@\"]{2,})$/i.test( + value, + ) || + $report( + _exceptionable, + { + path: + _path + + $join( + key, + ), + expected: + 'string & Format<"email">', + value: value, + }, + ))) || + $report(_exceptionable, { + path: + _path + $join(key), + expected: + '(string & Format<"email">)', + value: value, + }) + ); + return true; + }) + .every((flag: boolean) => flag), + ].every((flag: boolean) => flag); + return ( + ((("object" === typeof input && + null !== input && + false === Array.isArray(input)) || + $report(true, { + path: _path + "", + expected: "DynamicTag", + value: input, + })) && + $vo0(input, _path + "", true)) || + $report(true, { + path: _path + "", + expected: "DynamicTag", + value: input, + }) + ); + })(input, "$input", true); + } + const success = 0 === errors.length; + return { + success, + errors, + data: success ? input : undefined, + } as any; + }; + const general = ( + input: DynamicTag, + ): typia.PascalCase => { + const $co0 = (input: any): any => { + const output = {} as any; + for (const [key, value] of Object.entries(input)) { + if ( + RegExp( + /^[+-]?\d+(?:\.\d+)?(?:[eE][+-]?\d+)?$/, + ).test(key) + ) { + output[key] = value as any; + continue; + } + if (RegExp(/(.*)/).test(key)) { + output[key] = value as any; + continue; + } + } + return output; + }; + return "object" === typeof input && null !== input + ? $co0(input) + : (input as any); + }; + const output = validate(input) as any; + if (output.success) output.data = general(input); + return output; + }, + assert: (input: any): typia.PascalCase => { + const __is = ( + input: any, + ): input is typia.PascalCase => { + const $io0 = (input: any): boolean => + Object.keys(input).every((key: any) => { + const value = input[key]; + if (undefined === value) return true; + if ( + "number" === typeof Number(key) && + 0 <= Number(key) && + Number(key) < 10 + ) + return ( + "bigint" === typeof value && BigInt(0) <= value + ); + if ( + "string" === typeof key && + /^(?:[0-9a-f]{8}-[0-9a-f]{4}-[1-5][0-9a-f]{3}-[89ab][0-9a-f]{3}-[0-9a-f]{12}|00000000-0000-0000-0000-000000000000)$/i.test( + key, + ) + ) + return ( + "string" === typeof value && + /^(([^<>()[\]\.,;:\s@\"]+(\.[^<>()[\]\.,;:\s@\"]+)*)|(\".+\"))@(([^<>()[\]\.,;:\s@\"]+\.)+[^<>()[\]\.,;:\s@\"]{2,})$/i.test( + value, + ) + ); + return true; + }); + return ( + "object" === typeof input && + null !== input && + false === Array.isArray(input) && + $io0(input) + ); + }; + if (false === __is(input)) + (( + input: any, + _path: string, + _exceptionable: boolean = true, + ): input is typia.PascalCase => { + const $guard = (typia.createAssert as any).guard; + const $join = (typia.createAssert as any).join; + const $ao0 = ( + input: any, + _path: string, + _exceptionable: boolean = true, + ): boolean => + false === _exceptionable || + Object.keys(input).every((key: any) => { + const value = input[key]; + if (undefined === value) return true; + if ( + "number" === typeof Number(key) && + 0 <= Number(key) && + Number(key) < 10 + ) + return ( + ("bigint" === typeof value && + (BigInt(0) <= value || + $guard(_exceptionable, { + path: _path + $join(key), + expected: + 'bigint & Type<"uint64">', + value: value, + }))) || + $guard(_exceptionable, { + path: _path + $join(key), + expected: '(bigint & Type<"uint64">)', + value: value, + }) + ); + if ( + "string" === typeof key && + /^(?:[0-9a-f]{8}-[0-9a-f]{4}-[1-5][0-9a-f]{3}-[89ab][0-9a-f]{3}-[0-9a-f]{12}|00000000-0000-0000-0000-000000000000)$/i.test( + key, + ) + ) + return ( + ("string" === typeof value && + (/^(([^<>()[\]\.,;:\s@\"]+(\.[^<>()[\]\.,;:\s@\"]+)*)|(\".+\"))@(([^<>()[\]\.,;:\s@\"]+\.)+[^<>()[\]\.,;:\s@\"]{2,})$/i.test( + value, + ) || + $guard(_exceptionable, { + path: _path + $join(key), + expected: + 'string & Format<"email">', + value: value, + }))) || + $guard(_exceptionable, { + path: _path + $join(key), + expected: '(string & Format<"email">)', + value: value, + }) + ); + return true; + }); + return ( + ((("object" === typeof input && + null !== input && + false === Array.isArray(input)) || + $guard(true, { + path: _path + "", + expected: "DynamicTag", + value: input, + })) && + $ao0(input, _path + "", true)) || + $guard(true, { + path: _path + "", + expected: "DynamicTag", + value: input, + }) + ); + })(input, "$input", true); + return input; + }, + }); diff --git a/test/generated/output/notation.createPascal/test_notation_createPascal_DynamicTemplate.ts b/test/generated/output/notation.createPascal/test_notation_createPascal_DynamicTemplate.ts index 7776814499..ca107f6ad2 100644 --- a/test/generated/output/notation.createPascal/test_notation_createPascal_DynamicTemplate.ts +++ b/test/generated/output/notation.createPascal/test_notation_createPascal_DynamicTemplate.ts @@ -18,13 +18,20 @@ export const test_notation_createValidatePascal_DynamicTemplate = Object.keys(input).every((key: any) => { const value = input[key]; if (undefined === value) return true; - if (RegExp(/^(prefix_(.*))/).test(key)) + if ( + "string" === typeof key && + RegExp(/^prefix_(.*)/).test(key) + ) return "string" === typeof value; - if (RegExp(/((.*)_postfix)$/).test(key)) + if ( + "string" === typeof key && + RegExp(/(.*)_postfix$/).test(key) + ) return "string" === typeof value; if ( + "string" === typeof key && RegExp( - /^(value_[+-]?\d+(?:\.\d+)?(?:[eE][+-]?\d+)?)$/, + /^value_[+-]?\d+(?:\.\d+)?(?:[eE][+-]?\d+)?$/, ).test(key) ) return ( @@ -32,8 +39,9 @@ export const test_notation_createValidatePascal_DynamicTemplate = Number.isFinite(value) ); if ( + "string" === typeof key && RegExp( - /^(between_(.*)_and_[+-]?\d+(?:\.\d+)?(?:[eE][+-]?\d+)?)$/, + /^between_(.*)_and_[+-]?\d+(?:\.\d+)?(?:[eE][+-]?\d+)?$/, ).test(key) ) return "boolean" === typeof value; @@ -71,9 +79,8 @@ export const test_notation_createValidatePascal_DynamicTemplate = if (undefined === value) return true; if ( - RegExp(/^(prefix_(.*))/).test( - key, - ) + "string" === typeof key && + RegExp(/^prefix_(.*)/).test(key) ) return ( "string" === typeof value || @@ -85,7 +92,8 @@ export const test_notation_createValidatePascal_DynamicTemplate = }) ); if ( - RegExp(/((.*)_postfix)$/).test( + "string" === typeof key && + RegExp(/(.*)_postfix$/).test( key, ) ) @@ -99,8 +107,9 @@ export const test_notation_createValidatePascal_DynamicTemplate = }) ); if ( + "string" === typeof key && RegExp( - /^(value_[+-]?\d+(?:\.\d+)?(?:[eE][+-]?\d+)?)$/, + /^value_[+-]?\d+(?:\.\d+)?(?:[eE][+-]?\d+)?$/, ).test(key) ) return ( @@ -117,8 +126,9 @@ export const test_notation_createValidatePascal_DynamicTemplate = }) ); if ( + "string" === typeof key && RegExp( - /^(between_(.*)_and_[+-]?\d+(?:\.\d+)?(?:[eE][+-]?\d+)?)$/, + /^between_(.*)_and_[+-]?\d+(?:\.\d+)?(?:[eE][+-]?\d+)?$/, ).test(key) ) return ( @@ -209,13 +219,20 @@ export const test_notation_createValidatePascal_DynamicTemplate = Object.keys(input).every((key: any) => { const value = input[key]; if (undefined === value) return true; - if (RegExp(/^(prefix_(.*))/).test(key)) + if ( + "string" === typeof key && + RegExp(/^prefix_(.*)/).test(key) + ) return "string" === typeof value; - if (RegExp(/((.*)_postfix)$/).test(key)) + if ( + "string" === typeof key && + RegExp(/(.*)_postfix$/).test(key) + ) return "string" === typeof value; if ( + "string" === typeof key && RegExp( - /^(value_[+-]?\d+(?:\.\d+)?(?:[eE][+-]?\d+)?)$/, + /^value_[+-]?\d+(?:\.\d+)?(?:[eE][+-]?\d+)?$/, ).test(key) ) return ( @@ -223,8 +240,9 @@ export const test_notation_createValidatePascal_DynamicTemplate = Number.isFinite(value) ); if ( + "string" === typeof key && RegExp( - /^(between_(.*)_and_[+-]?\d+(?:\.\d+)?(?:[eE][+-]?\d+)?)$/, + /^between_(.*)_and_[+-]?\d+(?:\.\d+)?(?:[eE][+-]?\d+)?$/, ).test(key) ) return "boolean" === typeof value; @@ -254,7 +272,10 @@ export const test_notation_createValidatePascal_DynamicTemplate = Object.keys(input).every((key: any) => { const value = input[key]; if (undefined === value) return true; - if (RegExp(/^(prefix_(.*))/).test(key)) + if ( + "string" === typeof key && + RegExp(/^prefix_(.*)/).test(key) + ) return ( "string" === typeof value || $guard(_exceptionable, { @@ -263,7 +284,10 @@ export const test_notation_createValidatePascal_DynamicTemplate = value: value, }) ); - if (RegExp(/((.*)_postfix)$/).test(key)) + if ( + "string" === typeof key && + RegExp(/(.*)_postfix$/).test(key) + ) return ( "string" === typeof value || $guard(_exceptionable, { @@ -273,8 +297,9 @@ export const test_notation_createValidatePascal_DynamicTemplate = }) ); if ( + "string" === typeof key && RegExp( - /^(value_[+-]?\d+(?:\.\d+)?(?:[eE][+-]?\d+)?)$/, + /^value_[+-]?\d+(?:\.\d+)?(?:[eE][+-]?\d+)?$/, ).test(key) ) return ( @@ -287,8 +312,9 @@ export const test_notation_createValidatePascal_DynamicTemplate = }) ); if ( + "string" === typeof key && RegExp( - /^(between_(.*)_and_[+-]?\d+(?:\.\d+)?(?:[eE][+-]?\d+)?)$/, + /^between_(.*)_and_[+-]?\d+(?:\.\d+)?(?:[eE][+-]?\d+)?$/, ).test(key) ) return ( diff --git a/test/generated/output/notation.createPascal/test_notation_createPascal_DynamicUndefined.ts b/test/generated/output/notation.createPascal/test_notation_createPascal_DynamicUndefined.ts index d31d7d297b..44d365f6a6 100644 --- a/test/generated/output/notation.createPascal/test_notation_createPascal_DynamicUndefined.ts +++ b/test/generated/output/notation.createPascal/test_notation_createPascal_DynamicUndefined.ts @@ -18,7 +18,7 @@ export const test_notation_createValidatePascal_DynamicUndefined = Object.keys(input).every((key: any) => { const value = input[key]; if (undefined === value) return true; - if (RegExp(/(.*)/).test(key)) + if (true) return null !== value && undefined === value; return true; }); @@ -53,7 +53,7 @@ export const test_notation_createValidatePascal_DynamicUndefined = const value = input[key]; if (undefined === value) return true; - if (RegExp(/(.*)/).test(key)) + if (true) return ( (null !== value || $report( @@ -138,8 +138,7 @@ export const test_notation_createValidatePascal_DynamicUndefined = Object.keys(input).every((key: any) => { const value = input[key]; if (undefined === value) return true; - if (RegExp(/(.*)/).test(key)) - return null !== value && undefined === value; + if (true) return null !== value && undefined === value; return true; }); return ( @@ -166,7 +165,7 @@ export const test_notation_createValidatePascal_DynamicUndefined = Object.keys(input).every((key: any) => { const value = input[key]; if (undefined === value) return true; - if (RegExp(/(.*)/).test(key)) + if (true) return ( (null !== value || $guard(_exceptionable, { diff --git a/test/generated/output/notation.createPascal/test_notation_createPascal_DynamicUnion.ts b/test/generated/output/notation.createPascal/test_notation_createPascal_DynamicUnion.ts index c55eda973c..45d18777d6 100644 --- a/test/generated/output/notation.createPascal/test_notation_createPascal_DynamicUnion.ts +++ b/test/generated/output/notation.createPascal/test_notation_createPascal_DynamicUnion.ts @@ -17,18 +17,24 @@ export const test_notation_createValidatePascal_DynamicUnion = const value = input[key]; if (undefined === value) return true; if ( - RegExp( - /^[+-]?\d+(?:\.\d+)?(?:[eE][+-]?\d+)?$/, - ).test(key) + "number" === typeof Number(key) && + Number.isFinite(Number(key)) ) return "string" === typeof value; - if (RegExp(/^(prefix_(.*))/).test(key)) + if ( + "string" === typeof key && + RegExp(/^prefix_(.*)/).test(key) + ) return "string" === typeof value; - if (RegExp(/((.*)_postfix)$/).test(key)) + if ( + "string" === typeof key && + RegExp(/(.*)_postfix$/).test(key) + ) return "string" === typeof value; if ( + "string" === typeof key && RegExp( - /^(value_between_[+-]?\d+(?:\.\d+)?(?:[eE][+-]?\d+)?_and_[+-]?\d+(?:\.\d+)?(?:[eE][+-]?\d+)?)$/, + /^value_between_[+-]?\d+(?:\.\d+)?(?:[eE][+-]?\d+)?_and_[+-]?\d+(?:\.\d+)?(?:[eE][+-]?\d+)?$/, ).test(key) ) return ( @@ -69,9 +75,9 @@ export const test_notation_createValidatePascal_DynamicUnion = if (undefined === value) return true; if ( - RegExp( - /^[+-]?\d+(?:\.\d+)?(?:[eE][+-]?\d+)?$/, - ).test(key) + "number" === + typeof Number(key) && + Number.isFinite(Number(key)) ) return ( "string" === typeof value || @@ -83,9 +89,8 @@ export const test_notation_createValidatePascal_DynamicUnion = }) ); if ( - RegExp(/^(prefix_(.*))/).test( - key, - ) + "string" === typeof key && + RegExp(/^prefix_(.*)/).test(key) ) return ( "string" === typeof value || @@ -97,7 +102,8 @@ export const test_notation_createValidatePascal_DynamicUnion = }) ); if ( - RegExp(/((.*)_postfix)$/).test( + "string" === typeof key && + RegExp(/(.*)_postfix$/).test( key, ) ) @@ -111,8 +117,9 @@ export const test_notation_createValidatePascal_DynamicUnion = }) ); if ( + "string" === typeof key && RegExp( - /^(value_between_[+-]?\d+(?:\.\d+)?(?:[eE][+-]?\d+)?_and_[+-]?\d+(?:\.\d+)?(?:[eE][+-]?\d+)?)$/, + /^value_between_[+-]?\d+(?:\.\d+)?(?:[eE][+-]?\d+)?_and_[+-]?\d+(?:\.\d+)?(?:[eE][+-]?\d+)?$/, ).test(key) ) return ( @@ -207,18 +214,24 @@ export const test_notation_createValidatePascal_DynamicUnion = const value = input[key]; if (undefined === value) return true; if ( - RegExp( - /^[+-]?\d+(?:\.\d+)?(?:[eE][+-]?\d+)?$/, - ).test(key) + "number" === typeof Number(key) && + Number.isFinite(Number(key)) ) return "string" === typeof value; - if (RegExp(/^(prefix_(.*))/).test(key)) + if ( + "string" === typeof key && + RegExp(/^prefix_(.*)/).test(key) + ) return "string" === typeof value; - if (RegExp(/((.*)_postfix)$/).test(key)) + if ( + "string" === typeof key && + RegExp(/(.*)_postfix$/).test(key) + ) return "string" === typeof value; if ( + "string" === typeof key && RegExp( - /^(value_between_[+-]?\d+(?:\.\d+)?(?:[eE][+-]?\d+)?_and_[+-]?\d+(?:\.\d+)?(?:[eE][+-]?\d+)?)$/, + /^value_between_[+-]?\d+(?:\.\d+)?(?:[eE][+-]?\d+)?_and_[+-]?\d+(?:\.\d+)?(?:[eE][+-]?\d+)?$/, ).test(key) ) return ( @@ -252,9 +265,8 @@ export const test_notation_createValidatePascal_DynamicUnion = const value = input[key]; if (undefined === value) return true; if ( - RegExp( - /^[+-]?\d+(?:\.\d+)?(?:[eE][+-]?\d+)?$/, - ).test(key) + "number" === typeof Number(key) && + Number.isFinite(Number(key)) ) return ( "string" === typeof value || @@ -264,7 +276,10 @@ export const test_notation_createValidatePascal_DynamicUnion = value: value, }) ); - if (RegExp(/^(prefix_(.*))/).test(key)) + if ( + "string" === typeof key && + RegExp(/^prefix_(.*)/).test(key) + ) return ( "string" === typeof value || $guard(_exceptionable, { @@ -273,7 +288,10 @@ export const test_notation_createValidatePascal_DynamicUnion = value: value, }) ); - if (RegExp(/((.*)_postfix)$/).test(key)) + if ( + "string" === typeof key && + RegExp(/(.*)_postfix$/).test(key) + ) return ( "string" === typeof value || $guard(_exceptionable, { @@ -283,8 +301,9 @@ export const test_notation_createValidatePascal_DynamicUnion = }) ); if ( + "string" === typeof key && RegExp( - /^(value_between_[+-]?\d+(?:\.\d+)?(?:[eE][+-]?\d+)?_and_[+-]?\d+(?:\.\d+)?(?:[eE][+-]?\d+)?)$/, + /^value_between_[+-]?\d+(?:\.\d+)?(?:[eE][+-]?\d+)?_and_[+-]?\d+(?:\.\d+)?(?:[eE][+-]?\d+)?$/, ).test(key) ) return ( diff --git a/test/generated/output/notation.createPascal/test_notation_createPascal_ObjectDynamic.ts b/test/generated/output/notation.createPascal/test_notation_createPascal_ObjectDynamic.ts index 227811fde3..f36eb5f9ab 100644 --- a/test/generated/output/notation.createPascal/test_notation_createPascal_ObjectDynamic.ts +++ b/test/generated/output/notation.createPascal/test_notation_createPascal_ObjectDynamic.ts @@ -16,7 +16,7 @@ export const test_notation_createValidatePascal_ObjectDynamic = Object.keys(input).every((key: any) => { const value = input[key]; if (undefined === value) return true; - if (RegExp(/(.*)/).test(key)) + if (true) return ( "string" === typeof value || ("number" === typeof value && @@ -56,7 +56,7 @@ export const test_notation_createValidatePascal_ObjectDynamic = const value = input[key]; if (undefined === value) return true; - if (RegExp(/(.*)/).test(key)) + if (true) return ( "string" === typeof value || ("number" === @@ -132,7 +132,7 @@ export const test_notation_createValidatePascal_ObjectDynamic = Object.keys(input).every((key: any) => { const value = input[key]; if (undefined === value) return true; - if (RegExp(/(.*)/).test(key)) + if (true) return ( "string" === typeof value || ("number" === typeof value && @@ -165,7 +165,7 @@ export const test_notation_createValidatePascal_ObjectDynamic = Object.keys(input).every((key: any) => { const value = input[key]; if (undefined === value) return true; - if (RegExp(/(.*)/).test(key)) + if (true) return ( "string" === typeof value || ("number" === typeof value && diff --git a/test/generated/output/notation.createSnake/test_notation_createSnake_DynamicComposite.ts b/test/generated/output/notation.createSnake/test_notation_createSnake_DynamicComposite.ts index 5689e5d72d..026452a110 100644 --- a/test/generated/output/notation.createSnake/test_notation_createSnake_DynamicComposite.ts +++ b/test/generated/output/notation.createSnake/test_notation_createSnake_DynamicComposite.ts @@ -25,21 +25,27 @@ export const test_notation_createValidateSnake_DynamicComposite = const value = input[key]; if (undefined === value) return true; if ( - RegExp( - /^[+-]?\d+(?:\.\d+)?(?:[eE][+-]?\d+)?$/, - ).test(key) + "number" === typeof Number(key) && + Number.isFinite(Number(key)) ) return ( "number" === typeof value && Number.isFinite(value) ); - if (RegExp(/^(prefix_(.*))/).test(key)) + if ( + "string" === typeof key && + RegExp(/^prefix_(.*)/).test(key) + ) return "string" === typeof value; - if (RegExp(/((.*)_postfix)$/).test(key)) + if ( + "string" === typeof key && + RegExp(/(.*)_postfix$/).test(key) + ) return "string" === typeof value; if ( + "string" === typeof key && RegExp( - /^(value_[+-]?\d+(?:\.\d+)?(?:[eE][+-]?\d+)?)$/, + /^value_[+-]?\d+(?:\.\d+)?(?:[eE][+-]?\d+)?$/, ).test(key) ) return ( @@ -49,8 +55,9 @@ export const test_notation_createValidateSnake_DynamicComposite = "boolean" === typeof value ); if ( + "string" === typeof key && RegExp( - /^(between_(.*)_and_[+-]?\d+(?:\.\d+)?(?:[eE][+-]?\d+)?)$/, + /^between_(.*)_and_[+-]?\d+(?:\.\d+)?(?:[eE][+-]?\d+)?$/, ).test(key) ) return "boolean" === typeof value; @@ -105,9 +112,9 @@ export const test_notation_createValidateSnake_DynamicComposite = if (undefined === value) return true; if ( - RegExp( - /^[+-]?\d+(?:\.\d+)?(?:[eE][+-]?\d+)?$/, - ).test(key) + "number" === + typeof Number(key) && + Number.isFinite(Number(key)) ) return ( ("number" === @@ -123,9 +130,8 @@ export const test_notation_createValidateSnake_DynamicComposite = }) ); if ( - RegExp(/^(prefix_(.*))/).test( - key, - ) + "string" === typeof key && + RegExp(/^prefix_(.*)/).test(key) ) return ( "string" === typeof value || @@ -137,7 +143,8 @@ export const test_notation_createValidateSnake_DynamicComposite = }) ); if ( - RegExp(/((.*)_postfix)$/).test( + "string" === typeof key && + RegExp(/(.*)_postfix$/).test( key, ) ) @@ -151,8 +158,9 @@ export const test_notation_createValidateSnake_DynamicComposite = }) ); if ( + "string" === typeof key && RegExp( - /^(value_[+-]?\d+(?:\.\d+)?(?:[eE][+-]?\d+)?)$/, + /^value_[+-]?\d+(?:\.\d+)?(?:[eE][+-]?\d+)?$/, ).test(key) ) return ( @@ -173,8 +181,9 @@ export const test_notation_createValidateSnake_DynamicComposite = }) ); if ( + "string" === typeof key && RegExp( - /^(between_(.*)_and_[+-]?\d+(?:\.\d+)?(?:[eE][+-]?\d+)?)$/, + /^between_(.*)_and_[+-]?\d+(?:\.\d+)?(?:[eE][+-]?\d+)?$/, ).test(key) ) return ( @@ -285,21 +294,27 @@ export const test_notation_createValidateSnake_DynamicComposite = const value = input[key]; if (undefined === value) return true; if ( - RegExp( - /^[+-]?\d+(?:\.\d+)?(?:[eE][+-]?\d+)?$/, - ).test(key) + "number" === typeof Number(key) && + Number.isFinite(Number(key)) ) return ( "number" === typeof value && Number.isFinite(value) ); - if (RegExp(/^(prefix_(.*))/).test(key)) + if ( + "string" === typeof key && + RegExp(/^prefix_(.*)/).test(key) + ) return "string" === typeof value; - if (RegExp(/((.*)_postfix)$/).test(key)) + if ( + "string" === typeof key && + RegExp(/(.*)_postfix$/).test(key) + ) return "string" === typeof value; if ( + "string" === typeof key && RegExp( - /^(value_[+-]?\d+(?:\.\d+)?(?:[eE][+-]?\d+)?)$/, + /^value_[+-]?\d+(?:\.\d+)?(?:[eE][+-]?\d+)?$/, ).test(key) ) return ( @@ -309,8 +324,9 @@ export const test_notation_createValidateSnake_DynamicComposite = "boolean" === typeof value ); if ( + "string" === typeof key && RegExp( - /^(between_(.*)_and_[+-]?\d+(?:\.\d+)?(?:[eE][+-]?\d+)?)$/, + /^between_(.*)_and_[+-]?\d+(?:\.\d+)?(?:[eE][+-]?\d+)?$/, ).test(key) ) return "boolean" === typeof value; @@ -356,9 +372,8 @@ export const test_notation_createValidateSnake_DynamicComposite = const value = input[key]; if (undefined === value) return true; if ( - RegExp( - /^[+-]?\d+(?:\.\d+)?(?:[eE][+-]?\d+)?$/, - ).test(key) + "number" === typeof Number(key) && + Number.isFinite(Number(key)) ) return ( ("number" === typeof value && @@ -369,7 +384,10 @@ export const test_notation_createValidateSnake_DynamicComposite = value: value, }) ); - if (RegExp(/^(prefix_(.*))/).test(key)) + if ( + "string" === typeof key && + RegExp(/^prefix_(.*)/).test(key) + ) return ( "string" === typeof value || $guard(_exceptionable, { @@ -378,7 +396,10 @@ export const test_notation_createValidateSnake_DynamicComposite = value: value, }) ); - if (RegExp(/((.*)_postfix)$/).test(key)) + if ( + "string" === typeof key && + RegExp(/(.*)_postfix$/).test(key) + ) return ( "string" === typeof value || $guard(_exceptionable, { @@ -388,8 +409,9 @@ export const test_notation_createValidateSnake_DynamicComposite = }) ); if ( + "string" === typeof key && RegExp( - /^(value_[+-]?\d+(?:\.\d+)?(?:[eE][+-]?\d+)?)$/, + /^value_[+-]?\d+(?:\.\d+)?(?:[eE][+-]?\d+)?$/, ).test(key) ) return ( @@ -405,8 +427,9 @@ export const test_notation_createValidateSnake_DynamicComposite = }) ); if ( + "string" === typeof key && RegExp( - /^(between_(.*)_and_[+-]?\d+(?:\.\d+)?(?:[eE][+-]?\d+)?)$/, + /^between_(.*)_and_[+-]?\d+(?:\.\d+)?(?:[eE][+-]?\d+)?$/, ).test(key) ) return ( diff --git a/test/generated/output/notation.createSnake/test_notation_createSnake_DynamicNever.ts b/test/generated/output/notation.createSnake/test_notation_createSnake_DynamicNever.ts index 900af15b5f..420cc73b3e 100644 --- a/test/generated/output/notation.createSnake/test_notation_createSnake_DynamicNever.ts +++ b/test/generated/output/notation.createSnake/test_notation_createSnake_DynamicNever.ts @@ -16,7 +16,7 @@ export const test_notation_createValidateSnake_DynamicNever = Object.keys(input).every((key: any) => { const value = input[key]; if (undefined === value) return true; - if (RegExp(/(.*)/).test(key)) + if (true) return null !== value && undefined === value; return true; }); @@ -51,7 +51,7 @@ export const test_notation_createValidateSnake_DynamicNever = const value = input[key]; if (undefined === value) return true; - if (RegExp(/(.*)/).test(key)) + if (true) return ( (null !== value || $report( @@ -136,8 +136,7 @@ export const test_notation_createValidateSnake_DynamicNever = Object.keys(input).every((key: any) => { const value = input[key]; if (undefined === value) return true; - if (RegExp(/(.*)/).test(key)) - return null !== value && undefined === value; + if (true) return null !== value && undefined === value; return true; }); return ( @@ -164,7 +163,7 @@ export const test_notation_createValidateSnake_DynamicNever = Object.keys(input).every((key: any) => { const value = input[key]; if (undefined === value) return true; - if (RegExp(/(.*)/).test(key)) + if (true) return ( (null !== value || $guard(_exceptionable, { diff --git a/test/generated/output/notation.createSnake/test_notation_createSnake_DynamicTag.ts b/test/generated/output/notation.createSnake/test_notation_createSnake_DynamicTag.ts new file mode 100644 index 0000000000..7e4639695a --- /dev/null +++ b/test/generated/output/notation.createSnake/test_notation_createSnake_DynamicTag.ts @@ -0,0 +1,311 @@ +import typia from "../../../../src"; +import { _test_notation_validateGeneral } from "../../../internal/_test_notation_validateGeneral"; +import { DynamicTag } from "../../../structures/DynamicTag"; + +export const test_notation_createValidateSnake_DynamicTag = + _test_notation_validateGeneral("DynamicTag")(DynamicTag)< + typia.SnakeCase + >({ + convert: ( + input: any, + ): typia.IValidation> => { + const validate = (input: any): typia.IValidation => { + const errors = [] as any[]; + const __is = (input: any): input is DynamicTag => { + const $io0 = (input: any): boolean => + Object.keys(input).every((key: any) => { + const value = input[key]; + if (undefined === value) return true; + if ( + "number" === typeof Number(key) && + 0 <= Number(key) && + Number(key) < 10 + ) + return ( + "bigint" === typeof value && + BigInt(0) <= value + ); + if ( + "string" === typeof key && + /^(?:[0-9a-f]{8}-[0-9a-f]{4}-[1-5][0-9a-f]{3}-[89ab][0-9a-f]{3}-[0-9a-f]{12}|00000000-0000-0000-0000-000000000000)$/i.test( + key, + ) + ) + return ( + "string" === typeof value && + /^(([^<>()[\]\.,;:\s@\"]+(\.[^<>()[\]\.,;:\s@\"]+)*)|(\".+\"))@(([^<>()[\]\.,;:\s@\"]+\.)+[^<>()[\]\.,;:\s@\"]{2,})$/i.test( + value, + ) + ); + return true; + }); + return ( + "object" === typeof input && + null !== input && + false === Array.isArray(input) && + $io0(input) + ); + }; + if (false === __is(input)) { + const $report = ( + typia.notations.createValidateSnake as any + ).report(errors); + (( + input: any, + _path: string, + _exceptionable: boolean = true, + ): input is DynamicTag => { + const $join = ( + typia.notations.createValidateSnake as any + ).join; + const $vo0 = ( + input: any, + _path: string, + _exceptionable: boolean = true, + ): boolean => + [ + false === _exceptionable || + Object.keys(input) + .map((key: any) => { + const value = input[key]; + if (undefined === value) + return true; + if ( + "number" === + typeof Number(key) && + 0 <= Number(key) && + Number(key) < 10 + ) + return ( + ("bigint" === + typeof value && + (BigInt(0) <= value || + $report( + _exceptionable, + { + path: + _path + + $join( + key, + ), + expected: + 'bigint & Type<"uint64">', + value: value, + }, + ))) || + $report(_exceptionable, { + path: + _path + $join(key), + expected: + '(bigint & Type<"uint64">)', + value: value, + }) + ); + if ( + "string" === typeof key && + /^(?:[0-9a-f]{8}-[0-9a-f]{4}-[1-5][0-9a-f]{3}-[89ab][0-9a-f]{3}-[0-9a-f]{12}|00000000-0000-0000-0000-000000000000)$/i.test( + key, + ) + ) + return ( + ("string" === + typeof value && + (/^(([^<>()[\]\.,;:\s@\"]+(\.[^<>()[\]\.,;:\s@\"]+)*)|(\".+\"))@(([^<>()[\]\.,;:\s@\"]+\.)+[^<>()[\]\.,;:\s@\"]{2,})$/i.test( + value, + ) || + $report( + _exceptionable, + { + path: + _path + + $join( + key, + ), + expected: + 'string & Format<"email">', + value: value, + }, + ))) || + $report(_exceptionable, { + path: + _path + $join(key), + expected: + '(string & Format<"email">)', + value: value, + }) + ); + return true; + }) + .every((flag: boolean) => flag), + ].every((flag: boolean) => flag); + return ( + ((("object" === typeof input && + null !== input && + false === Array.isArray(input)) || + $report(true, { + path: _path + "", + expected: "DynamicTag", + value: input, + })) && + $vo0(input, _path + "", true)) || + $report(true, { + path: _path + "", + expected: "DynamicTag", + value: input, + }) + ); + })(input, "$input", true); + } + const success = 0 === errors.length; + return { + success, + errors, + data: success ? input : undefined, + } as any; + }; + const general = ( + input: DynamicTag, + ): typia.SnakeCase => { + const $co0 = (input: any): any => { + const output = {} as any; + for (const [key, value] of Object.entries(input)) { + if ( + RegExp( + /^[+-]?\d+(?:\.\d+)?(?:[eE][+-]?\d+)?$/, + ).test(key) + ) { + output[key] = value as any; + continue; + } + if (RegExp(/(.*)/).test(key)) { + output[key] = value as any; + continue; + } + } + return output; + }; + return "object" === typeof input && null !== input + ? $co0(input) + : (input as any); + }; + const output = validate(input) as any; + if (output.success) output.data = general(input); + return output; + }, + assert: (input: any): typia.SnakeCase => { + const __is = (input: any): input is typia.SnakeCase => { + const $io0 = (input: any): boolean => + Object.keys(input).every((key: any) => { + const value = input[key]; + if (undefined === value) return true; + if ( + "number" === typeof Number(key) && + 0 <= Number(key) && + Number(key) < 10 + ) + return ( + "bigint" === typeof value && BigInt(0) <= value + ); + if ( + "string" === typeof key && + /^(?:[0-9a-f]{8}-[0-9a-f]{4}-[1-5][0-9a-f]{3}-[89ab][0-9a-f]{3}-[0-9a-f]{12}|00000000-0000-0000-0000-000000000000)$/i.test( + key, + ) + ) + return ( + "string" === typeof value && + /^(([^<>()[\]\.,;:\s@\"]+(\.[^<>()[\]\.,;:\s@\"]+)*)|(\".+\"))@(([^<>()[\]\.,;:\s@\"]+\.)+[^<>()[\]\.,;:\s@\"]{2,})$/i.test( + value, + ) + ); + return true; + }); + return ( + "object" === typeof input && + null !== input && + false === Array.isArray(input) && + $io0(input) + ); + }; + if (false === __is(input)) + (( + input: any, + _path: string, + _exceptionable: boolean = true, + ): input is typia.SnakeCase => { + const $guard = (typia.createAssert as any).guard; + const $join = (typia.createAssert as any).join; + const $ao0 = ( + input: any, + _path: string, + _exceptionable: boolean = true, + ): boolean => + false === _exceptionable || + Object.keys(input).every((key: any) => { + const value = input[key]; + if (undefined === value) return true; + if ( + "number" === typeof Number(key) && + 0 <= Number(key) && + Number(key) < 10 + ) + return ( + ("bigint" === typeof value && + (BigInt(0) <= value || + $guard(_exceptionable, { + path: _path + $join(key), + expected: + 'bigint & Type<"uint64">', + value: value, + }))) || + $guard(_exceptionable, { + path: _path + $join(key), + expected: '(bigint & Type<"uint64">)', + value: value, + }) + ); + if ( + "string" === typeof key && + /^(?:[0-9a-f]{8}-[0-9a-f]{4}-[1-5][0-9a-f]{3}-[89ab][0-9a-f]{3}-[0-9a-f]{12}|00000000-0000-0000-0000-000000000000)$/i.test( + key, + ) + ) + return ( + ("string" === typeof value && + (/^(([^<>()[\]\.,;:\s@\"]+(\.[^<>()[\]\.,;:\s@\"]+)*)|(\".+\"))@(([^<>()[\]\.,;:\s@\"]+\.)+[^<>()[\]\.,;:\s@\"]{2,})$/i.test( + value, + ) || + $guard(_exceptionable, { + path: _path + $join(key), + expected: + 'string & Format<"email">', + value: value, + }))) || + $guard(_exceptionable, { + path: _path + $join(key), + expected: '(string & Format<"email">)', + value: value, + }) + ); + return true; + }); + return ( + ((("object" === typeof input && + null !== input && + false === Array.isArray(input)) || + $guard(true, { + path: _path + "", + expected: "DynamicTag", + value: input, + })) && + $ao0(input, _path + "", true)) || + $guard(true, { + path: _path + "", + expected: "DynamicTag", + value: input, + }) + ); + })(input, "$input", true); + return input; + }, + }); diff --git a/test/generated/output/notation.createSnake/test_notation_createSnake_DynamicTemplate.ts b/test/generated/output/notation.createSnake/test_notation_createSnake_DynamicTemplate.ts index a61766d3ad..87b94d1def 100644 --- a/test/generated/output/notation.createSnake/test_notation_createSnake_DynamicTemplate.ts +++ b/test/generated/output/notation.createSnake/test_notation_createSnake_DynamicTemplate.ts @@ -18,13 +18,20 @@ export const test_notation_createValidateSnake_DynamicTemplate = Object.keys(input).every((key: any) => { const value = input[key]; if (undefined === value) return true; - if (RegExp(/^(prefix_(.*))/).test(key)) + if ( + "string" === typeof key && + RegExp(/^prefix_(.*)/).test(key) + ) return "string" === typeof value; - if (RegExp(/((.*)_postfix)$/).test(key)) + if ( + "string" === typeof key && + RegExp(/(.*)_postfix$/).test(key) + ) return "string" === typeof value; if ( + "string" === typeof key && RegExp( - /^(value_[+-]?\d+(?:\.\d+)?(?:[eE][+-]?\d+)?)$/, + /^value_[+-]?\d+(?:\.\d+)?(?:[eE][+-]?\d+)?$/, ).test(key) ) return ( @@ -32,8 +39,9 @@ export const test_notation_createValidateSnake_DynamicTemplate = Number.isFinite(value) ); if ( + "string" === typeof key && RegExp( - /^(between_(.*)_and_[+-]?\d+(?:\.\d+)?(?:[eE][+-]?\d+)?)$/, + /^between_(.*)_and_[+-]?\d+(?:\.\d+)?(?:[eE][+-]?\d+)?$/, ).test(key) ) return "boolean" === typeof value; @@ -71,9 +79,8 @@ export const test_notation_createValidateSnake_DynamicTemplate = if (undefined === value) return true; if ( - RegExp(/^(prefix_(.*))/).test( - key, - ) + "string" === typeof key && + RegExp(/^prefix_(.*)/).test(key) ) return ( "string" === typeof value || @@ -85,7 +92,8 @@ export const test_notation_createValidateSnake_DynamicTemplate = }) ); if ( - RegExp(/((.*)_postfix)$/).test( + "string" === typeof key && + RegExp(/(.*)_postfix$/).test( key, ) ) @@ -99,8 +107,9 @@ export const test_notation_createValidateSnake_DynamicTemplate = }) ); if ( + "string" === typeof key && RegExp( - /^(value_[+-]?\d+(?:\.\d+)?(?:[eE][+-]?\d+)?)$/, + /^value_[+-]?\d+(?:\.\d+)?(?:[eE][+-]?\d+)?$/, ).test(key) ) return ( @@ -117,8 +126,9 @@ export const test_notation_createValidateSnake_DynamicTemplate = }) ); if ( + "string" === typeof key && RegExp( - /^(between_(.*)_and_[+-]?\d+(?:\.\d+)?(?:[eE][+-]?\d+)?)$/, + /^between_(.*)_and_[+-]?\d+(?:\.\d+)?(?:[eE][+-]?\d+)?$/, ).test(key) ) return ( @@ -209,13 +219,20 @@ export const test_notation_createValidateSnake_DynamicTemplate = Object.keys(input).every((key: any) => { const value = input[key]; if (undefined === value) return true; - if (RegExp(/^(prefix_(.*))/).test(key)) + if ( + "string" === typeof key && + RegExp(/^prefix_(.*)/).test(key) + ) return "string" === typeof value; - if (RegExp(/((.*)_postfix)$/).test(key)) + if ( + "string" === typeof key && + RegExp(/(.*)_postfix$/).test(key) + ) return "string" === typeof value; if ( + "string" === typeof key && RegExp( - /^(value_[+-]?\d+(?:\.\d+)?(?:[eE][+-]?\d+)?)$/, + /^value_[+-]?\d+(?:\.\d+)?(?:[eE][+-]?\d+)?$/, ).test(key) ) return ( @@ -223,8 +240,9 @@ export const test_notation_createValidateSnake_DynamicTemplate = Number.isFinite(value) ); if ( + "string" === typeof key && RegExp( - /^(between_(.*)_and_[+-]?\d+(?:\.\d+)?(?:[eE][+-]?\d+)?)$/, + /^between_(.*)_and_[+-]?\d+(?:\.\d+)?(?:[eE][+-]?\d+)?$/, ).test(key) ) return "boolean" === typeof value; @@ -254,7 +272,10 @@ export const test_notation_createValidateSnake_DynamicTemplate = Object.keys(input).every((key: any) => { const value = input[key]; if (undefined === value) return true; - if (RegExp(/^(prefix_(.*))/).test(key)) + if ( + "string" === typeof key && + RegExp(/^prefix_(.*)/).test(key) + ) return ( "string" === typeof value || $guard(_exceptionable, { @@ -263,7 +284,10 @@ export const test_notation_createValidateSnake_DynamicTemplate = value: value, }) ); - if (RegExp(/((.*)_postfix)$/).test(key)) + if ( + "string" === typeof key && + RegExp(/(.*)_postfix$/).test(key) + ) return ( "string" === typeof value || $guard(_exceptionable, { @@ -273,8 +297,9 @@ export const test_notation_createValidateSnake_DynamicTemplate = }) ); if ( + "string" === typeof key && RegExp( - /^(value_[+-]?\d+(?:\.\d+)?(?:[eE][+-]?\d+)?)$/, + /^value_[+-]?\d+(?:\.\d+)?(?:[eE][+-]?\d+)?$/, ).test(key) ) return ( @@ -287,8 +312,9 @@ export const test_notation_createValidateSnake_DynamicTemplate = }) ); if ( + "string" === typeof key && RegExp( - /^(between_(.*)_and_[+-]?\d+(?:\.\d+)?(?:[eE][+-]?\d+)?)$/, + /^between_(.*)_and_[+-]?\d+(?:\.\d+)?(?:[eE][+-]?\d+)?$/, ).test(key) ) return ( diff --git a/test/generated/output/notation.createSnake/test_notation_createSnake_DynamicTree.ts b/test/generated/output/notation.createSnake/test_notation_createSnake_DynamicTree.ts index 26bbfeb226..f7581d8747 100644 --- a/test/generated/output/notation.createSnake/test_notation_createSnake_DynamicTree.ts +++ b/test/generated/output/notation.createSnake/test_notation_createSnake_DynamicTree.ts @@ -24,7 +24,7 @@ export const test_notation_createValidateSnake_DynamicTree = Object.keys(input).every((key: any) => { const value = input[key]; if (undefined === value) return true; - if (RegExp(/(.*)/).test(key)) + if (true) return ( "object" === typeof value && null !== value && @@ -100,7 +100,7 @@ export const test_notation_createValidateSnake_DynamicTree = const value = input[key]; if (undefined === value) return true; - if (RegExp(/(.*)/).test(key)) + if (true) return ( ((("object" === typeof value && @@ -170,7 +170,7 @@ export const test_notation_createValidateSnake_DynamicTree = Object.keys(input).every((key: any) => { const value = input[key]; if (undefined === value) return true; - if (RegExp(/(.*)/).test(key)) + if (true) return ( "object" === typeof value && null !== value && @@ -224,7 +224,7 @@ export const test_notation_createValidateSnake_DynamicTree = Object.keys(input).every((key: any) => { const value = input[key]; if (undefined === value) return true; - if (RegExp(/(.*)/).test(key)) + if (true) return ( "object" === typeof value && null !== value && @@ -289,7 +289,7 @@ export const test_notation_createValidateSnake_DynamicTree = Object.keys(input).every((key: any) => { const value = input[key]; if (undefined === value) return true; - if (RegExp(/(.*)/).test(key)) + if (true) return ( ((("object" === typeof value && null !== value) || diff --git a/test/generated/output/notation.createSnake/test_notation_createSnake_DynamicUndefined.ts b/test/generated/output/notation.createSnake/test_notation_createSnake_DynamicUndefined.ts index c68a66c72c..7902f7edf1 100644 --- a/test/generated/output/notation.createSnake/test_notation_createSnake_DynamicUndefined.ts +++ b/test/generated/output/notation.createSnake/test_notation_createSnake_DynamicUndefined.ts @@ -18,7 +18,7 @@ export const test_notation_createValidateSnake_DynamicUndefined = Object.keys(input).every((key: any) => { const value = input[key]; if (undefined === value) return true; - if (RegExp(/(.*)/).test(key)) + if (true) return null !== value && undefined === value; return true; }); @@ -53,7 +53,7 @@ export const test_notation_createValidateSnake_DynamicUndefined = const value = input[key]; if (undefined === value) return true; - if (RegExp(/(.*)/).test(key)) + if (true) return ( (null !== value || $report( @@ -138,8 +138,7 @@ export const test_notation_createValidateSnake_DynamicUndefined = Object.keys(input).every((key: any) => { const value = input[key]; if (undefined === value) return true; - if (RegExp(/(.*)/).test(key)) - return null !== value && undefined === value; + if (true) return null !== value && undefined === value; return true; }); return ( @@ -166,7 +165,7 @@ export const test_notation_createValidateSnake_DynamicUndefined = Object.keys(input).every((key: any) => { const value = input[key]; if (undefined === value) return true; - if (RegExp(/(.*)/).test(key)) + if (true) return ( (null !== value || $guard(_exceptionable, { diff --git a/test/generated/output/notation.createSnake/test_notation_createSnake_DynamicUnion.ts b/test/generated/output/notation.createSnake/test_notation_createSnake_DynamicUnion.ts index 48fa9971f2..08623e25f6 100644 --- a/test/generated/output/notation.createSnake/test_notation_createSnake_DynamicUnion.ts +++ b/test/generated/output/notation.createSnake/test_notation_createSnake_DynamicUnion.ts @@ -17,18 +17,24 @@ export const test_notation_createValidateSnake_DynamicUnion = const value = input[key]; if (undefined === value) return true; if ( - RegExp( - /^[+-]?\d+(?:\.\d+)?(?:[eE][+-]?\d+)?$/, - ).test(key) + "number" === typeof Number(key) && + Number.isFinite(Number(key)) ) return "string" === typeof value; - if (RegExp(/^(prefix_(.*))/).test(key)) + if ( + "string" === typeof key && + RegExp(/^prefix_(.*)/).test(key) + ) return "string" === typeof value; - if (RegExp(/((.*)_postfix)$/).test(key)) + if ( + "string" === typeof key && + RegExp(/(.*)_postfix$/).test(key) + ) return "string" === typeof value; if ( + "string" === typeof key && RegExp( - /^(value_between_[+-]?\d+(?:\.\d+)?(?:[eE][+-]?\d+)?_and_[+-]?\d+(?:\.\d+)?(?:[eE][+-]?\d+)?)$/, + /^value_between_[+-]?\d+(?:\.\d+)?(?:[eE][+-]?\d+)?_and_[+-]?\d+(?:\.\d+)?(?:[eE][+-]?\d+)?$/, ).test(key) ) return ( @@ -69,9 +75,9 @@ export const test_notation_createValidateSnake_DynamicUnion = if (undefined === value) return true; if ( - RegExp( - /^[+-]?\d+(?:\.\d+)?(?:[eE][+-]?\d+)?$/, - ).test(key) + "number" === + typeof Number(key) && + Number.isFinite(Number(key)) ) return ( "string" === typeof value || @@ -83,9 +89,8 @@ export const test_notation_createValidateSnake_DynamicUnion = }) ); if ( - RegExp(/^(prefix_(.*))/).test( - key, - ) + "string" === typeof key && + RegExp(/^prefix_(.*)/).test(key) ) return ( "string" === typeof value || @@ -97,7 +102,8 @@ export const test_notation_createValidateSnake_DynamicUnion = }) ); if ( - RegExp(/((.*)_postfix)$/).test( + "string" === typeof key && + RegExp(/(.*)_postfix$/).test( key, ) ) @@ -111,8 +117,9 @@ export const test_notation_createValidateSnake_DynamicUnion = }) ); if ( + "string" === typeof key && RegExp( - /^(value_between_[+-]?\d+(?:\.\d+)?(?:[eE][+-]?\d+)?_and_[+-]?\d+(?:\.\d+)?(?:[eE][+-]?\d+)?)$/, + /^value_between_[+-]?\d+(?:\.\d+)?(?:[eE][+-]?\d+)?_and_[+-]?\d+(?:\.\d+)?(?:[eE][+-]?\d+)?$/, ).test(key) ) return ( @@ -207,18 +214,24 @@ export const test_notation_createValidateSnake_DynamicUnion = const value = input[key]; if (undefined === value) return true; if ( - RegExp( - /^[+-]?\d+(?:\.\d+)?(?:[eE][+-]?\d+)?$/, - ).test(key) + "number" === typeof Number(key) && + Number.isFinite(Number(key)) ) return "string" === typeof value; - if (RegExp(/^(prefix_(.*))/).test(key)) + if ( + "string" === typeof key && + RegExp(/^prefix_(.*)/).test(key) + ) return "string" === typeof value; - if (RegExp(/((.*)_postfix)$/).test(key)) + if ( + "string" === typeof key && + RegExp(/(.*)_postfix$/).test(key) + ) return "string" === typeof value; if ( + "string" === typeof key && RegExp( - /^(value_between_[+-]?\d+(?:\.\d+)?(?:[eE][+-]?\d+)?_and_[+-]?\d+(?:\.\d+)?(?:[eE][+-]?\d+)?)$/, + /^value_between_[+-]?\d+(?:\.\d+)?(?:[eE][+-]?\d+)?_and_[+-]?\d+(?:\.\d+)?(?:[eE][+-]?\d+)?$/, ).test(key) ) return ( @@ -252,9 +265,8 @@ export const test_notation_createValidateSnake_DynamicUnion = const value = input[key]; if (undefined === value) return true; if ( - RegExp( - /^[+-]?\d+(?:\.\d+)?(?:[eE][+-]?\d+)?$/, - ).test(key) + "number" === typeof Number(key) && + Number.isFinite(Number(key)) ) return ( "string" === typeof value || @@ -264,7 +276,10 @@ export const test_notation_createValidateSnake_DynamicUnion = value: value, }) ); - if (RegExp(/^(prefix_(.*))/).test(key)) + if ( + "string" === typeof key && + RegExp(/^prefix_(.*)/).test(key) + ) return ( "string" === typeof value || $guard(_exceptionable, { @@ -273,7 +288,10 @@ export const test_notation_createValidateSnake_DynamicUnion = value: value, }) ); - if (RegExp(/((.*)_postfix)$/).test(key)) + if ( + "string" === typeof key && + RegExp(/(.*)_postfix$/).test(key) + ) return ( "string" === typeof value || $guard(_exceptionable, { @@ -283,8 +301,9 @@ export const test_notation_createValidateSnake_DynamicUnion = }) ); if ( + "string" === typeof key && RegExp( - /^(value_between_[+-]?\d+(?:\.\d+)?(?:[eE][+-]?\d+)?_and_[+-]?\d+(?:\.\d+)?(?:[eE][+-]?\d+)?)$/, + /^value_between_[+-]?\d+(?:\.\d+)?(?:[eE][+-]?\d+)?_and_[+-]?\d+(?:\.\d+)?(?:[eE][+-]?\d+)?$/, ).test(key) ) return ( diff --git a/test/generated/output/notation.createSnake/test_notation_createSnake_ObjectDynamic.ts b/test/generated/output/notation.createSnake/test_notation_createSnake_ObjectDynamic.ts index dc73c37084..b8b329f5f5 100644 --- a/test/generated/output/notation.createSnake/test_notation_createSnake_ObjectDynamic.ts +++ b/test/generated/output/notation.createSnake/test_notation_createSnake_ObjectDynamic.ts @@ -16,7 +16,7 @@ export const test_notation_createValidateSnake_ObjectDynamic = Object.keys(input).every((key: any) => { const value = input[key]; if (undefined === value) return true; - if (RegExp(/(.*)/).test(key)) + if (true) return ( "string" === typeof value || ("number" === typeof value && @@ -56,7 +56,7 @@ export const test_notation_createValidateSnake_ObjectDynamic = const value = input[key]; if (undefined === value) return true; - if (RegExp(/(.*)/).test(key)) + if (true) return ( "string" === typeof value || ("number" === @@ -132,7 +132,7 @@ export const test_notation_createValidateSnake_ObjectDynamic = Object.keys(input).every((key: any) => { const value = input[key]; if (undefined === value) return true; - if (RegExp(/(.*)/).test(key)) + if (true) return ( "string" === typeof value || ("number" === typeof value && @@ -165,7 +165,7 @@ export const test_notation_createValidateSnake_ObjectDynamic = Object.keys(input).every((key: any) => { const value = input[key]; if (undefined === value) return true; - if (RegExp(/(.*)/).test(key)) + if (true) return ( "string" === typeof value || ("number" === typeof value && diff --git a/test/generated/output/notation.pascal/test_notation_pascal_DynamicNever.ts b/test/generated/output/notation.pascal/test_notation_pascal_DynamicNever.ts index 865ed44073..c9b617d3b7 100644 --- a/test/generated/output/notation.pascal/test_notation_pascal_DynamicNever.ts +++ b/test/generated/output/notation.pascal/test_notation_pascal_DynamicNever.ts @@ -19,7 +19,7 @@ export const test_notation_validatePascal_DynamicNever = Object.keys(input).every((key: any) => { const value = input[key]; if (undefined === value) return true; - if (RegExp(/(.*)/).test(key)) + if (true) return ( null !== value && undefined === value ); @@ -56,7 +56,7 @@ export const test_notation_validatePascal_DynamicNever = const value = input[key]; if (undefined === value) return true; - if (RegExp(/(.*)/).test(key)) + if (true) return ( (null !== value || $report( @@ -145,8 +145,7 @@ export const test_notation_validatePascal_DynamicNever = Object.keys(input).every((key: any) => { const value = input[key]; if (undefined === value) return true; - if (RegExp(/(.*)/).test(key)) - return null !== value && undefined === value; + if (true) return null !== value && undefined === value; return true; }); return ( @@ -173,7 +172,7 @@ export const test_notation_validatePascal_DynamicNever = Object.keys(input).every((key: any) => { const value = input[key]; if (undefined === value) return true; - if (RegExp(/(.*)/).test(key)) + if (true) return ( (null !== value || $guard(_exceptionable, { diff --git a/test/generated/output/notation.pascal/test_notation_pascal_DynamicTag.ts b/test/generated/output/notation.pascal/test_notation_pascal_DynamicTag.ts new file mode 100644 index 0000000000..87cd4130fe --- /dev/null +++ b/test/generated/output/notation.pascal/test_notation_pascal_DynamicTag.ts @@ -0,0 +1,323 @@ +import typia from "../../../../src"; +import { _test_notation_validateGeneral } from "../../../internal/_test_notation_validateGeneral"; +import { DynamicTag } from "../../../structures/DynamicTag"; + +export const test_notation_validatePascal_DynamicTag = + _test_notation_validateGeneral("DynamicTag")(DynamicTag)< + typia.PascalCase + >({ + convert: (input) => + ((input: any): typia.IValidation> => { + const validate = ( + input: any, + ): typia.IValidation => { + const errors = [] as any[]; + const __is = (input: any): input is DynamicTag => { + const $io0 = (input: any): boolean => + Object.keys(input).every((key: any) => { + const value = input[key]; + if (undefined === value) return true; + if ( + "number" === typeof Number(key) && + 0 <= Number(key) && + Number(key) < 10 + ) + return ( + "bigint" === typeof value && + BigInt(0) <= value + ); + if ( + "string" === typeof key && + /^(?:[0-9a-f]{8}-[0-9a-f]{4}-[1-5][0-9a-f]{3}-[89ab][0-9a-f]{3}-[0-9a-f]{12}|00000000-0000-0000-0000-000000000000)$/i.test( + key, + ) + ) + return ( + "string" === typeof value && + /^(([^<>()[\]\.,;:\s@\"]+(\.[^<>()[\]\.,;:\s@\"]+)*)|(\".+\"))@(([^<>()[\]\.,;:\s@\"]+\.)+[^<>()[\]\.,;:\s@\"]{2,})$/i.test( + value, + ) + ); + return true; + }); + return ( + "object" === typeof input && + null !== input && + false === Array.isArray(input) && + $io0(input) + ); + }; + if (false === __is(input)) { + const $report = ( + typia.notations.validatePascal as any + ).report(errors); + (( + input: any, + _path: string, + _exceptionable: boolean = true, + ): input is DynamicTag => { + const $join = ( + typia.notations.validatePascal as any + ).join; + const $vo0 = ( + input: any, + _path: string, + _exceptionable: boolean = true, + ): boolean => + [ + false === _exceptionable || + Object.keys(input) + .map((key: any) => { + const value = input[key]; + if (undefined === value) + return true; + if ( + "number" === + typeof Number(key) && + 0 <= Number(key) && + Number(key) < 10 + ) + return ( + ("bigint" === + typeof value && + (BigInt(0) <= + value || + $report( + _exceptionable, + { + path: + _path + + $join( + key, + ), + expected: + 'bigint & Type<"uint64">', + value: value, + }, + ))) || + $report( + _exceptionable, + { + path: + _path + + $join(key), + expected: + '(bigint & Type<"uint64">)', + value: value, + }, + ) + ); + if ( + "string" === typeof key && + /^(?:[0-9a-f]{8}-[0-9a-f]{4}-[1-5][0-9a-f]{3}-[89ab][0-9a-f]{3}-[0-9a-f]{12}|00000000-0000-0000-0000-000000000000)$/i.test( + key, + ) + ) + return ( + ("string" === + typeof value && + (/^(([^<>()[\]\.,;:\s@\"]+(\.[^<>()[\]\.,;:\s@\"]+)*)|(\".+\"))@(([^<>()[\]\.,;:\s@\"]+\.)+[^<>()[\]\.,;:\s@\"]{2,})$/i.test( + value, + ) || + $report( + _exceptionable, + { + path: + _path + + $join( + key, + ), + expected: + 'string & Format<"email">', + value: value, + }, + ))) || + $report( + _exceptionable, + { + path: + _path + + $join(key), + expected: + '(string & Format<"email">)', + value: value, + }, + ) + ); + return true; + }) + .every((flag: boolean) => flag), + ].every((flag: boolean) => flag); + return ( + ((("object" === typeof input && + null !== input && + false === Array.isArray(input)) || + $report(true, { + path: _path + "", + expected: "DynamicTag", + value: input, + })) && + $vo0(input, _path + "", true)) || + $report(true, { + path: _path + "", + expected: "DynamicTag", + value: input, + }) + ); + })(input, "$input", true); + } + const success = 0 === errors.length; + return { + success, + errors, + data: success ? input : undefined, + } as any; + }; + const general = ( + input: DynamicTag, + ): typia.PascalCase => { + const $co0 = (input: any): any => { + const output = {} as any; + for (const [key, value] of Object.entries(input)) { + if ( + RegExp( + /^[+-]?\d+(?:\.\d+)?(?:[eE][+-]?\d+)?$/, + ).test(key) + ) { + output[key] = value as any; + continue; + } + if (RegExp(/(.*)/).test(key)) { + output[key] = value as any; + continue; + } + } + return output; + }; + return "object" === typeof input && null !== input + ? $co0(input) + : (input as any); + }; + const output = validate(input) as any; + if (output.success) output.data = general(input); + return output; + })(input), + assert: (input: any): typia.PascalCase => { + const __is = ( + input: any, + ): input is typia.PascalCase => { + const $io0 = (input: any): boolean => + Object.keys(input).every((key: any) => { + const value = input[key]; + if (undefined === value) return true; + if ( + "number" === typeof Number(key) && + 0 <= Number(key) && + Number(key) < 10 + ) + return ( + "bigint" === typeof value && BigInt(0) <= value + ); + if ( + "string" === typeof key && + /^(?:[0-9a-f]{8}-[0-9a-f]{4}-[1-5][0-9a-f]{3}-[89ab][0-9a-f]{3}-[0-9a-f]{12}|00000000-0000-0000-0000-000000000000)$/i.test( + key, + ) + ) + return ( + "string" === typeof value && + /^(([^<>()[\]\.,;:\s@\"]+(\.[^<>()[\]\.,;:\s@\"]+)*)|(\".+\"))@(([^<>()[\]\.,;:\s@\"]+\.)+[^<>()[\]\.,;:\s@\"]{2,})$/i.test( + value, + ) + ); + return true; + }); + return ( + "object" === typeof input && + null !== input && + false === Array.isArray(input) && + $io0(input) + ); + }; + if (false === __is(input)) + (( + input: any, + _path: string, + _exceptionable: boolean = true, + ): input is typia.PascalCase => { + const $guard = (typia.createAssert as any).guard; + const $join = (typia.createAssert as any).join; + const $ao0 = ( + input: any, + _path: string, + _exceptionable: boolean = true, + ): boolean => + false === _exceptionable || + Object.keys(input).every((key: any) => { + const value = input[key]; + if (undefined === value) return true; + if ( + "number" === typeof Number(key) && + 0 <= Number(key) && + Number(key) < 10 + ) + return ( + ("bigint" === typeof value && + (BigInt(0) <= value || + $guard(_exceptionable, { + path: _path + $join(key), + expected: + 'bigint & Type<"uint64">', + value: value, + }))) || + $guard(_exceptionable, { + path: _path + $join(key), + expected: '(bigint & Type<"uint64">)', + value: value, + }) + ); + if ( + "string" === typeof key && + /^(?:[0-9a-f]{8}-[0-9a-f]{4}-[1-5][0-9a-f]{3}-[89ab][0-9a-f]{3}-[0-9a-f]{12}|00000000-0000-0000-0000-000000000000)$/i.test( + key, + ) + ) + return ( + ("string" === typeof value && + (/^(([^<>()[\]\.,;:\s@\"]+(\.[^<>()[\]\.,;:\s@\"]+)*)|(\".+\"))@(([^<>()[\]\.,;:\s@\"]+\.)+[^<>()[\]\.,;:\s@\"]{2,})$/i.test( + value, + ) || + $guard(_exceptionable, { + path: _path + $join(key), + expected: + 'string & Format<"email">', + value: value, + }))) || + $guard(_exceptionable, { + path: _path + $join(key), + expected: '(string & Format<"email">)', + value: value, + }) + ); + return true; + }); + return ( + ((("object" === typeof input && + null !== input && + false === Array.isArray(input)) || + $guard(true, { + path: _path + "", + expected: "DynamicTag", + value: input, + })) && + $ao0(input, _path + "", true)) || + $guard(true, { + path: _path + "", + expected: "DynamicTag", + value: input, + }) + ); + })(input, "$input", true); + return input; + }, + }); diff --git a/test/generated/output/notation.pascal/test_notation_pascal_DynamicTemplate.ts b/test/generated/output/notation.pascal/test_notation_pascal_DynamicTemplate.ts index 5aceb1548e..b4663dac6b 100644 --- a/test/generated/output/notation.pascal/test_notation_pascal_DynamicTemplate.ts +++ b/test/generated/output/notation.pascal/test_notation_pascal_DynamicTemplate.ts @@ -19,13 +19,20 @@ export const test_notation_validatePascal_DynamicTemplate = Object.keys(input).every((key: any) => { const value = input[key]; if (undefined === value) return true; - if (RegExp(/^(prefix_(.*))/).test(key)) + if ( + "string" === typeof key && + RegExp(/^prefix_(.*)/).test(key) + ) return "string" === typeof value; - if (RegExp(/((.*)_postfix)$/).test(key)) + if ( + "string" === typeof key && + RegExp(/(.*)_postfix$/).test(key) + ) return "string" === typeof value; if ( + "string" === typeof key && RegExp( - /^(value_[+-]?\d+(?:\.\d+)?(?:[eE][+-]?\d+)?)$/, + /^value_[+-]?\d+(?:\.\d+)?(?:[eE][+-]?\d+)?$/, ).test(key) ) return ( @@ -33,8 +40,9 @@ export const test_notation_validatePascal_DynamicTemplate = Number.isFinite(value) ); if ( + "string" === typeof key && RegExp( - /^(between_(.*)_and_[+-]?\d+(?:\.\d+)?(?:[eE][+-]?\d+)?)$/, + /^between_(.*)_and_[+-]?\d+(?:\.\d+)?(?:[eE][+-]?\d+)?$/, ).test(key) ) return "boolean" === typeof value; @@ -72,9 +80,10 @@ export const test_notation_validatePascal_DynamicTemplate = if (undefined === value) return true; if ( - RegExp( - /^(prefix_(.*))/, - ).test(key) + "string" === typeof key && + RegExp(/^prefix_(.*)/).test( + key, + ) ) return ( "string" === @@ -92,8 +101,9 @@ export const test_notation_validatePascal_DynamicTemplate = ) ); if ( + "string" === typeof key && RegExp( - /((.*)_postfix)$/, + /(.*)_postfix$/, ).test(key) ) return ( @@ -112,8 +122,9 @@ export const test_notation_validatePascal_DynamicTemplate = ) ); if ( + "string" === typeof key && RegExp( - /^(value_[+-]?\d+(?:\.\d+)?(?:[eE][+-]?\d+)?)$/, + /^value_[+-]?\d+(?:\.\d+)?(?:[eE][+-]?\d+)?$/, ).test(key) ) return ( @@ -135,8 +146,9 @@ export const test_notation_validatePascal_DynamicTemplate = ) ); if ( + "string" === typeof key && RegExp( - /^(between_(.*)_and_[+-]?\d+(?:\.\d+)?(?:[eE][+-]?\d+)?)$/, + /^between_(.*)_and_[+-]?\d+(?:\.\d+)?(?:[eE][+-]?\d+)?$/, ).test(key) ) return ( @@ -232,13 +244,20 @@ export const test_notation_validatePascal_DynamicTemplate = Object.keys(input).every((key: any) => { const value = input[key]; if (undefined === value) return true; - if (RegExp(/^(prefix_(.*))/).test(key)) + if ( + "string" === typeof key && + RegExp(/^prefix_(.*)/).test(key) + ) return "string" === typeof value; - if (RegExp(/((.*)_postfix)$/).test(key)) + if ( + "string" === typeof key && + RegExp(/(.*)_postfix$/).test(key) + ) return "string" === typeof value; if ( + "string" === typeof key && RegExp( - /^(value_[+-]?\d+(?:\.\d+)?(?:[eE][+-]?\d+)?)$/, + /^value_[+-]?\d+(?:\.\d+)?(?:[eE][+-]?\d+)?$/, ).test(key) ) return ( @@ -246,8 +265,9 @@ export const test_notation_validatePascal_DynamicTemplate = Number.isFinite(value) ); if ( + "string" === typeof key && RegExp( - /^(between_(.*)_and_[+-]?\d+(?:\.\d+)?(?:[eE][+-]?\d+)?)$/, + /^between_(.*)_and_[+-]?\d+(?:\.\d+)?(?:[eE][+-]?\d+)?$/, ).test(key) ) return "boolean" === typeof value; @@ -277,7 +297,10 @@ export const test_notation_validatePascal_DynamicTemplate = Object.keys(input).every((key: any) => { const value = input[key]; if (undefined === value) return true; - if (RegExp(/^(prefix_(.*))/).test(key)) + if ( + "string" === typeof key && + RegExp(/^prefix_(.*)/).test(key) + ) return ( "string" === typeof value || $guard(_exceptionable, { @@ -286,7 +309,10 @@ export const test_notation_validatePascal_DynamicTemplate = value: value, }) ); - if (RegExp(/((.*)_postfix)$/).test(key)) + if ( + "string" === typeof key && + RegExp(/(.*)_postfix$/).test(key) + ) return ( "string" === typeof value || $guard(_exceptionable, { @@ -296,8 +322,9 @@ export const test_notation_validatePascal_DynamicTemplate = }) ); if ( + "string" === typeof key && RegExp( - /^(value_[+-]?\d+(?:\.\d+)?(?:[eE][+-]?\d+)?)$/, + /^value_[+-]?\d+(?:\.\d+)?(?:[eE][+-]?\d+)?$/, ).test(key) ) return ( @@ -310,8 +337,9 @@ export const test_notation_validatePascal_DynamicTemplate = }) ); if ( + "string" === typeof key && RegExp( - /^(between_(.*)_and_[+-]?\d+(?:\.\d+)?(?:[eE][+-]?\d+)?)$/, + /^between_(.*)_and_[+-]?\d+(?:\.\d+)?(?:[eE][+-]?\d+)?$/, ).test(key) ) return ( diff --git a/test/generated/output/notation.pascal/test_notation_pascal_DynamicUndefined.ts b/test/generated/output/notation.pascal/test_notation_pascal_DynamicUndefined.ts index 24fc216709..709e0e93b1 100644 --- a/test/generated/output/notation.pascal/test_notation_pascal_DynamicUndefined.ts +++ b/test/generated/output/notation.pascal/test_notation_pascal_DynamicUndefined.ts @@ -19,7 +19,7 @@ export const test_notation_validatePascal_DynamicUndefined = Object.keys(input).every((key: any) => { const value = input[key]; if (undefined === value) return true; - if (RegExp(/(.*)/).test(key)) + if (true) return ( null !== value && undefined === value ); @@ -56,7 +56,7 @@ export const test_notation_validatePascal_DynamicUndefined = const value = input[key]; if (undefined === value) return true; - if (RegExp(/(.*)/).test(key)) + if (true) return ( (null !== value || $report( @@ -145,8 +145,7 @@ export const test_notation_validatePascal_DynamicUndefined = Object.keys(input).every((key: any) => { const value = input[key]; if (undefined === value) return true; - if (RegExp(/(.*)/).test(key)) - return null !== value && undefined === value; + if (true) return null !== value && undefined === value; return true; }); return ( @@ -173,7 +172,7 @@ export const test_notation_validatePascal_DynamicUndefined = Object.keys(input).every((key: any) => { const value = input[key]; if (undefined === value) return true; - if (RegExp(/(.*)/).test(key)) + if (true) return ( (null !== value || $guard(_exceptionable, { diff --git a/test/generated/output/notation.pascal/test_notation_pascal_DynamicUnion.ts b/test/generated/output/notation.pascal/test_notation_pascal_DynamicUnion.ts index e8c415d433..60365533f4 100644 --- a/test/generated/output/notation.pascal/test_notation_pascal_DynamicUnion.ts +++ b/test/generated/output/notation.pascal/test_notation_pascal_DynamicUnion.ts @@ -20,18 +20,24 @@ export const test_notation_validatePascal_DynamicUnion = const value = input[key]; if (undefined === value) return true; if ( - RegExp( - /^[+-]?\d+(?:\.\d+)?(?:[eE][+-]?\d+)?$/, - ).test(key) + "number" === typeof Number(key) && + Number.isFinite(Number(key)) ) return "string" === typeof value; - if (RegExp(/^(prefix_(.*))/).test(key)) + if ( + "string" === typeof key && + RegExp(/^prefix_(.*)/).test(key) + ) return "string" === typeof value; - if (RegExp(/((.*)_postfix)$/).test(key)) + if ( + "string" === typeof key && + RegExp(/(.*)_postfix$/).test(key) + ) return "string" === typeof value; if ( + "string" === typeof key && RegExp( - /^(value_between_[+-]?\d+(?:\.\d+)?(?:[eE][+-]?\d+)?_and_[+-]?\d+(?:\.\d+)?(?:[eE][+-]?\d+)?)$/, + /^value_between_[+-]?\d+(?:\.\d+)?(?:[eE][+-]?\d+)?_and_[+-]?\d+(?:\.\d+)?(?:[eE][+-]?\d+)?$/, ).test(key) ) return ( @@ -72,9 +78,9 @@ export const test_notation_validatePascal_DynamicUnion = if (undefined === value) return true; if ( - RegExp( - /^[+-]?\d+(?:\.\d+)?(?:[eE][+-]?\d+)?$/, - ).test(key) + "number" === + typeof Number(key) && + Number.isFinite(Number(key)) ) return ( "string" === @@ -92,9 +98,10 @@ export const test_notation_validatePascal_DynamicUnion = ) ); if ( - RegExp( - /^(prefix_(.*))/, - ).test(key) + "string" === typeof key && + RegExp(/^prefix_(.*)/).test( + key, + ) ) return ( "string" === @@ -112,8 +119,9 @@ export const test_notation_validatePascal_DynamicUnion = ) ); if ( + "string" === typeof key && RegExp( - /((.*)_postfix)$/, + /(.*)_postfix$/, ).test(key) ) return ( @@ -132,8 +140,9 @@ export const test_notation_validatePascal_DynamicUnion = ) ); if ( + "string" === typeof key && RegExp( - /^(value_between_[+-]?\d+(?:\.\d+)?(?:[eE][+-]?\d+)?_and_[+-]?\d+(?:\.\d+)?(?:[eE][+-]?\d+)?)$/, + /^value_between_[+-]?\d+(?:\.\d+)?(?:[eE][+-]?\d+)?_and_[+-]?\d+(?:\.\d+)?(?:[eE][+-]?\d+)?$/, ).test(key) ) return ( @@ -233,18 +242,24 @@ export const test_notation_validatePascal_DynamicUnion = const value = input[key]; if (undefined === value) return true; if ( - RegExp( - /^[+-]?\d+(?:\.\d+)?(?:[eE][+-]?\d+)?$/, - ).test(key) + "number" === typeof Number(key) && + Number.isFinite(Number(key)) ) return "string" === typeof value; - if (RegExp(/^(prefix_(.*))/).test(key)) + if ( + "string" === typeof key && + RegExp(/^prefix_(.*)/).test(key) + ) return "string" === typeof value; - if (RegExp(/((.*)_postfix)$/).test(key)) + if ( + "string" === typeof key && + RegExp(/(.*)_postfix$/).test(key) + ) return "string" === typeof value; if ( + "string" === typeof key && RegExp( - /^(value_between_[+-]?\d+(?:\.\d+)?(?:[eE][+-]?\d+)?_and_[+-]?\d+(?:\.\d+)?(?:[eE][+-]?\d+)?)$/, + /^value_between_[+-]?\d+(?:\.\d+)?(?:[eE][+-]?\d+)?_and_[+-]?\d+(?:\.\d+)?(?:[eE][+-]?\d+)?$/, ).test(key) ) return ( @@ -278,9 +293,8 @@ export const test_notation_validatePascal_DynamicUnion = const value = input[key]; if (undefined === value) return true; if ( - RegExp( - /^[+-]?\d+(?:\.\d+)?(?:[eE][+-]?\d+)?$/, - ).test(key) + "number" === typeof Number(key) && + Number.isFinite(Number(key)) ) return ( "string" === typeof value || @@ -290,7 +304,10 @@ export const test_notation_validatePascal_DynamicUnion = value: value, }) ); - if (RegExp(/^(prefix_(.*))/).test(key)) + if ( + "string" === typeof key && + RegExp(/^prefix_(.*)/).test(key) + ) return ( "string" === typeof value || $guard(_exceptionable, { @@ -299,7 +316,10 @@ export const test_notation_validatePascal_DynamicUnion = value: value, }) ); - if (RegExp(/((.*)_postfix)$/).test(key)) + if ( + "string" === typeof key && + RegExp(/(.*)_postfix$/).test(key) + ) return ( "string" === typeof value || $guard(_exceptionable, { @@ -309,8 +329,9 @@ export const test_notation_validatePascal_DynamicUnion = }) ); if ( + "string" === typeof key && RegExp( - /^(value_between_[+-]?\d+(?:\.\d+)?(?:[eE][+-]?\d+)?_and_[+-]?\d+(?:\.\d+)?(?:[eE][+-]?\d+)?)$/, + /^value_between_[+-]?\d+(?:\.\d+)?(?:[eE][+-]?\d+)?_and_[+-]?\d+(?:\.\d+)?(?:[eE][+-]?\d+)?$/, ).test(key) ) return ( diff --git a/test/generated/output/notation.pascal/test_notation_pascal_ObjectDynamic.ts b/test/generated/output/notation.pascal/test_notation_pascal_ObjectDynamic.ts index 29b65d3ab8..f8d99c3613 100644 --- a/test/generated/output/notation.pascal/test_notation_pascal_ObjectDynamic.ts +++ b/test/generated/output/notation.pascal/test_notation_pascal_ObjectDynamic.ts @@ -19,7 +19,7 @@ export const test_notation_validatePascal_ObjectDynamic = Object.keys(input).every((key: any) => { const value = input[key]; if (undefined === value) return true; - if (RegExp(/(.*)/).test(key)) + if (true) return ( "string" === typeof value || ("number" === typeof value && @@ -59,7 +59,7 @@ export const test_notation_validatePascal_ObjectDynamic = const value = input[key]; if (undefined === value) return true; - if (RegExp(/(.*)/).test(key)) + if (true) return ( "string" === typeof value || @@ -140,7 +140,7 @@ export const test_notation_validatePascal_ObjectDynamic = Object.keys(input).every((key: any) => { const value = input[key]; if (undefined === value) return true; - if (RegExp(/(.*)/).test(key)) + if (true) return ( "string" === typeof value || ("number" === typeof value && @@ -173,7 +173,7 @@ export const test_notation_validatePascal_ObjectDynamic = Object.keys(input).every((key: any) => { const value = input[key]; if (undefined === value) return true; - if (RegExp(/(.*)/).test(key)) + if (true) return ( "string" === typeof value || ("number" === typeof value && diff --git a/test/generated/output/notation.snake/test_notation_snake_DynamicComposite.ts b/test/generated/output/notation.snake/test_notation_snake_DynamicComposite.ts index c1be2c9f8f..6e31c40316 100644 --- a/test/generated/output/notation.snake/test_notation_snake_DynamicComposite.ts +++ b/test/generated/output/notation.snake/test_notation_snake_DynamicComposite.ts @@ -28,21 +28,27 @@ export const test_notation_validateSnake_DynamicComposite = const value = input[key]; if (undefined === value) return true; if ( - RegExp( - /^[+-]?\d+(?:\.\d+)?(?:[eE][+-]?\d+)?$/, - ).test(key) + "number" === typeof Number(key) && + Number.isFinite(Number(key)) ) return ( "number" === typeof value && Number.isFinite(value) ); - if (RegExp(/^(prefix_(.*))/).test(key)) + if ( + "string" === typeof key && + RegExp(/^prefix_(.*)/).test(key) + ) return "string" === typeof value; - if (RegExp(/((.*)_postfix)$/).test(key)) + if ( + "string" === typeof key && + RegExp(/(.*)_postfix$/).test(key) + ) return "string" === typeof value; if ( + "string" === typeof key && RegExp( - /^(value_[+-]?\d+(?:\.\d+)?(?:[eE][+-]?\d+)?)$/, + /^value_[+-]?\d+(?:\.\d+)?(?:[eE][+-]?\d+)?$/, ).test(key) ) return ( @@ -52,8 +58,9 @@ export const test_notation_validateSnake_DynamicComposite = "boolean" === typeof value ); if ( + "string" === typeof key && RegExp( - /^(between_(.*)_and_[+-]?\d+(?:\.\d+)?(?:[eE][+-]?\d+)?)$/, + /^between_(.*)_and_[+-]?\d+(?:\.\d+)?(?:[eE][+-]?\d+)?$/, ).test(key) ) return "boolean" === typeof value; @@ -108,9 +115,9 @@ export const test_notation_validateSnake_DynamicComposite = if (undefined === value) return true; if ( - RegExp( - /^[+-]?\d+(?:\.\d+)?(?:[eE][+-]?\d+)?$/, - ).test(key) + "number" === + typeof Number(key) && + Number.isFinite(Number(key)) ) return ( ("number" === @@ -131,9 +138,10 @@ export const test_notation_validateSnake_DynamicComposite = ) ); if ( - RegExp( - /^(prefix_(.*))/, - ).test(key) + "string" === typeof key && + RegExp(/^prefix_(.*)/).test( + key, + ) ) return ( "string" === @@ -151,8 +159,9 @@ export const test_notation_validateSnake_DynamicComposite = ) ); if ( + "string" === typeof key && RegExp( - /((.*)_postfix)$/, + /(.*)_postfix$/, ).test(key) ) return ( @@ -171,8 +180,9 @@ export const test_notation_validateSnake_DynamicComposite = ) ); if ( + "string" === typeof key && RegExp( - /^(value_[+-]?\d+(?:\.\d+)?(?:[eE][+-]?\d+)?)$/, + /^value_[+-]?\d+(?:\.\d+)?(?:[eE][+-]?\d+)?$/, ).test(key) ) return ( @@ -198,8 +208,9 @@ export const test_notation_validateSnake_DynamicComposite = ) ); if ( + "string" === typeof key && RegExp( - /^(between_(.*)_and_[+-]?\d+(?:\.\d+)?(?:[eE][+-]?\d+)?)$/, + /^between_(.*)_and_[+-]?\d+(?:\.\d+)?(?:[eE][+-]?\d+)?$/, ).test(key) ) return ( @@ -316,21 +327,27 @@ export const test_notation_validateSnake_DynamicComposite = const value = input[key]; if (undefined === value) return true; if ( - RegExp( - /^[+-]?\d+(?:\.\d+)?(?:[eE][+-]?\d+)?$/, - ).test(key) + "number" === typeof Number(key) && + Number.isFinite(Number(key)) ) return ( "number" === typeof value && Number.isFinite(value) ); - if (RegExp(/^(prefix_(.*))/).test(key)) + if ( + "string" === typeof key && + RegExp(/^prefix_(.*)/).test(key) + ) return "string" === typeof value; - if (RegExp(/((.*)_postfix)$/).test(key)) + if ( + "string" === typeof key && + RegExp(/(.*)_postfix$/).test(key) + ) return "string" === typeof value; if ( + "string" === typeof key && RegExp( - /^(value_[+-]?\d+(?:\.\d+)?(?:[eE][+-]?\d+)?)$/, + /^value_[+-]?\d+(?:\.\d+)?(?:[eE][+-]?\d+)?$/, ).test(key) ) return ( @@ -340,8 +357,9 @@ export const test_notation_validateSnake_DynamicComposite = "boolean" === typeof value ); if ( + "string" === typeof key && RegExp( - /^(between_(.*)_and_[+-]?\d+(?:\.\d+)?(?:[eE][+-]?\d+)?)$/, + /^between_(.*)_and_[+-]?\d+(?:\.\d+)?(?:[eE][+-]?\d+)?$/, ).test(key) ) return "boolean" === typeof value; @@ -387,9 +405,8 @@ export const test_notation_validateSnake_DynamicComposite = const value = input[key]; if (undefined === value) return true; if ( - RegExp( - /^[+-]?\d+(?:\.\d+)?(?:[eE][+-]?\d+)?$/, - ).test(key) + "number" === typeof Number(key) && + Number.isFinite(Number(key)) ) return ( ("number" === typeof value && @@ -400,7 +417,10 @@ export const test_notation_validateSnake_DynamicComposite = value: value, }) ); - if (RegExp(/^(prefix_(.*))/).test(key)) + if ( + "string" === typeof key && + RegExp(/^prefix_(.*)/).test(key) + ) return ( "string" === typeof value || $guard(_exceptionable, { @@ -409,7 +429,10 @@ export const test_notation_validateSnake_DynamicComposite = value: value, }) ); - if (RegExp(/((.*)_postfix)$/).test(key)) + if ( + "string" === typeof key && + RegExp(/(.*)_postfix$/).test(key) + ) return ( "string" === typeof value || $guard(_exceptionable, { @@ -419,8 +442,9 @@ export const test_notation_validateSnake_DynamicComposite = }) ); if ( + "string" === typeof key && RegExp( - /^(value_[+-]?\d+(?:\.\d+)?(?:[eE][+-]?\d+)?)$/, + /^value_[+-]?\d+(?:\.\d+)?(?:[eE][+-]?\d+)?$/, ).test(key) ) return ( @@ -436,8 +460,9 @@ export const test_notation_validateSnake_DynamicComposite = }) ); if ( + "string" === typeof key && RegExp( - /^(between_(.*)_and_[+-]?\d+(?:\.\d+)?(?:[eE][+-]?\d+)?)$/, + /^between_(.*)_and_[+-]?\d+(?:\.\d+)?(?:[eE][+-]?\d+)?$/, ).test(key) ) return ( diff --git a/test/generated/output/notation.snake/test_notation_snake_DynamicNever.ts b/test/generated/output/notation.snake/test_notation_snake_DynamicNever.ts index ef3c05223d..e6b63de49c 100644 --- a/test/generated/output/notation.snake/test_notation_snake_DynamicNever.ts +++ b/test/generated/output/notation.snake/test_notation_snake_DynamicNever.ts @@ -17,7 +17,7 @@ export const test_notation_validateSnake_DynamicNever = Object.keys(input).every((key: any) => { const value = input[key]; if (undefined === value) return true; - if (RegExp(/(.*)/).test(key)) + if (true) return ( null !== value && undefined === value ); @@ -53,7 +53,7 @@ export const test_notation_validateSnake_DynamicNever = const value = input[key]; if (undefined === value) return true; - if (RegExp(/(.*)/).test(key)) + if (true) return ( (null !== value || $report( @@ -142,8 +142,7 @@ export const test_notation_validateSnake_DynamicNever = Object.keys(input).every((key: any) => { const value = input[key]; if (undefined === value) return true; - if (RegExp(/(.*)/).test(key)) - return null !== value && undefined === value; + if (true) return null !== value && undefined === value; return true; }); return ( @@ -170,7 +169,7 @@ export const test_notation_validateSnake_DynamicNever = Object.keys(input).every((key: any) => { const value = input[key]; if (undefined === value) return true; - if (RegExp(/(.*)/).test(key)) + if (true) return ( (null !== value || $guard(_exceptionable, { diff --git a/test/generated/output/notation.snake/test_notation_snake_DynamicTag.ts b/test/generated/output/notation.snake/test_notation_snake_DynamicTag.ts new file mode 100644 index 0000000000..9d2ea29064 --- /dev/null +++ b/test/generated/output/notation.snake/test_notation_snake_DynamicTag.ts @@ -0,0 +1,320 @@ +import typia from "../../../../src"; +import { _test_notation_validateGeneral } from "../../../internal/_test_notation_validateGeneral"; +import { DynamicTag } from "../../../structures/DynamicTag"; + +export const test_notation_validateSnake_DynamicTag = + _test_notation_validateGeneral("DynamicTag")(DynamicTag)< + typia.SnakeCase + >({ + convert: (input) => + ((input: any): typia.IValidation> => { + const validate = ( + input: any, + ): typia.IValidation => { + const errors = [] as any[]; + const __is = (input: any): input is DynamicTag => { + const $io0 = (input: any): boolean => + Object.keys(input).every((key: any) => { + const value = input[key]; + if (undefined === value) return true; + if ( + "number" === typeof Number(key) && + 0 <= Number(key) && + Number(key) < 10 + ) + return ( + "bigint" === typeof value && + BigInt(0) <= value + ); + if ( + "string" === typeof key && + /^(?:[0-9a-f]{8}-[0-9a-f]{4}-[1-5][0-9a-f]{3}-[89ab][0-9a-f]{3}-[0-9a-f]{12}|00000000-0000-0000-0000-000000000000)$/i.test( + key, + ) + ) + return ( + "string" === typeof value && + /^(([^<>()[\]\.,;:\s@\"]+(\.[^<>()[\]\.,;:\s@\"]+)*)|(\".+\"))@(([^<>()[\]\.,;:\s@\"]+\.)+[^<>()[\]\.,;:\s@\"]{2,})$/i.test( + value, + ) + ); + return true; + }); + return ( + "object" === typeof input && + null !== input && + false === Array.isArray(input) && + $io0(input) + ); + }; + if (false === __is(input)) { + const $report = ( + typia.notations.validateSnake as any + ).report(errors); + (( + input: any, + _path: string, + _exceptionable: boolean = true, + ): input is DynamicTag => { + const $join = (typia.notations.validateSnake as any) + .join; + const $vo0 = ( + input: any, + _path: string, + _exceptionable: boolean = true, + ): boolean => + [ + false === _exceptionable || + Object.keys(input) + .map((key: any) => { + const value = input[key]; + if (undefined === value) + return true; + if ( + "number" === + typeof Number(key) && + 0 <= Number(key) && + Number(key) < 10 + ) + return ( + ("bigint" === + typeof value && + (BigInt(0) <= + value || + $report( + _exceptionable, + { + path: + _path + + $join( + key, + ), + expected: + 'bigint & Type<"uint64">', + value: value, + }, + ))) || + $report( + _exceptionable, + { + path: + _path + + $join(key), + expected: + '(bigint & Type<"uint64">)', + value: value, + }, + ) + ); + if ( + "string" === typeof key && + /^(?:[0-9a-f]{8}-[0-9a-f]{4}-[1-5][0-9a-f]{3}-[89ab][0-9a-f]{3}-[0-9a-f]{12}|00000000-0000-0000-0000-000000000000)$/i.test( + key, + ) + ) + return ( + ("string" === + typeof value && + (/^(([^<>()[\]\.,;:\s@\"]+(\.[^<>()[\]\.,;:\s@\"]+)*)|(\".+\"))@(([^<>()[\]\.,;:\s@\"]+\.)+[^<>()[\]\.,;:\s@\"]{2,})$/i.test( + value, + ) || + $report( + _exceptionable, + { + path: + _path + + $join( + key, + ), + expected: + 'string & Format<"email">', + value: value, + }, + ))) || + $report( + _exceptionable, + { + path: + _path + + $join(key), + expected: + '(string & Format<"email">)', + value: value, + }, + ) + ); + return true; + }) + .every((flag: boolean) => flag), + ].every((flag: boolean) => flag); + return ( + ((("object" === typeof input && + null !== input && + false === Array.isArray(input)) || + $report(true, { + path: _path + "", + expected: "DynamicTag", + value: input, + })) && + $vo0(input, _path + "", true)) || + $report(true, { + path: _path + "", + expected: "DynamicTag", + value: input, + }) + ); + })(input, "$input", true); + } + const success = 0 === errors.length; + return { + success, + errors, + data: success ? input : undefined, + } as any; + }; + const general = ( + input: DynamicTag, + ): typia.SnakeCase => { + const $co0 = (input: any): any => { + const output = {} as any; + for (const [key, value] of Object.entries(input)) { + if ( + RegExp( + /^[+-]?\d+(?:\.\d+)?(?:[eE][+-]?\d+)?$/, + ).test(key) + ) { + output[key] = value as any; + continue; + } + if (RegExp(/(.*)/).test(key)) { + output[key] = value as any; + continue; + } + } + return output; + }; + return "object" === typeof input && null !== input + ? $co0(input) + : (input as any); + }; + const output = validate(input) as any; + if (output.success) output.data = general(input); + return output; + })(input), + assert: (input: any): typia.SnakeCase => { + const __is = (input: any): input is typia.SnakeCase => { + const $io0 = (input: any): boolean => + Object.keys(input).every((key: any) => { + const value = input[key]; + if (undefined === value) return true; + if ( + "number" === typeof Number(key) && + 0 <= Number(key) && + Number(key) < 10 + ) + return ( + "bigint" === typeof value && BigInt(0) <= value + ); + if ( + "string" === typeof key && + /^(?:[0-9a-f]{8}-[0-9a-f]{4}-[1-5][0-9a-f]{3}-[89ab][0-9a-f]{3}-[0-9a-f]{12}|00000000-0000-0000-0000-000000000000)$/i.test( + key, + ) + ) + return ( + "string" === typeof value && + /^(([^<>()[\]\.,;:\s@\"]+(\.[^<>()[\]\.,;:\s@\"]+)*)|(\".+\"))@(([^<>()[\]\.,;:\s@\"]+\.)+[^<>()[\]\.,;:\s@\"]{2,})$/i.test( + value, + ) + ); + return true; + }); + return ( + "object" === typeof input && + null !== input && + false === Array.isArray(input) && + $io0(input) + ); + }; + if (false === __is(input)) + (( + input: any, + _path: string, + _exceptionable: boolean = true, + ): input is typia.SnakeCase => { + const $guard = (typia.createAssert as any).guard; + const $join = (typia.createAssert as any).join; + const $ao0 = ( + input: any, + _path: string, + _exceptionable: boolean = true, + ): boolean => + false === _exceptionable || + Object.keys(input).every((key: any) => { + const value = input[key]; + if (undefined === value) return true; + if ( + "number" === typeof Number(key) && + 0 <= Number(key) && + Number(key) < 10 + ) + return ( + ("bigint" === typeof value && + (BigInt(0) <= value || + $guard(_exceptionable, { + path: _path + $join(key), + expected: + 'bigint & Type<"uint64">', + value: value, + }))) || + $guard(_exceptionable, { + path: _path + $join(key), + expected: '(bigint & Type<"uint64">)', + value: value, + }) + ); + if ( + "string" === typeof key && + /^(?:[0-9a-f]{8}-[0-9a-f]{4}-[1-5][0-9a-f]{3}-[89ab][0-9a-f]{3}-[0-9a-f]{12}|00000000-0000-0000-0000-000000000000)$/i.test( + key, + ) + ) + return ( + ("string" === typeof value && + (/^(([^<>()[\]\.,;:\s@\"]+(\.[^<>()[\]\.,;:\s@\"]+)*)|(\".+\"))@(([^<>()[\]\.,;:\s@\"]+\.)+[^<>()[\]\.,;:\s@\"]{2,})$/i.test( + value, + ) || + $guard(_exceptionable, { + path: _path + $join(key), + expected: + 'string & Format<"email">', + value: value, + }))) || + $guard(_exceptionable, { + path: _path + $join(key), + expected: '(string & Format<"email">)', + value: value, + }) + ); + return true; + }); + return ( + ((("object" === typeof input && + null !== input && + false === Array.isArray(input)) || + $guard(true, { + path: _path + "", + expected: "DynamicTag", + value: input, + })) && + $ao0(input, _path + "", true)) || + $guard(true, { + path: _path + "", + expected: "DynamicTag", + value: input, + }) + ); + })(input, "$input", true); + return input; + }, + }); diff --git a/test/generated/output/notation.snake/test_notation_snake_DynamicTemplate.ts b/test/generated/output/notation.snake/test_notation_snake_DynamicTemplate.ts index b45373e50e..4397f4a570 100644 --- a/test/generated/output/notation.snake/test_notation_snake_DynamicTemplate.ts +++ b/test/generated/output/notation.snake/test_notation_snake_DynamicTemplate.ts @@ -19,13 +19,20 @@ export const test_notation_validateSnake_DynamicTemplate = Object.keys(input).every((key: any) => { const value = input[key]; if (undefined === value) return true; - if (RegExp(/^(prefix_(.*))/).test(key)) + if ( + "string" === typeof key && + RegExp(/^prefix_(.*)/).test(key) + ) return "string" === typeof value; - if (RegExp(/((.*)_postfix)$/).test(key)) + if ( + "string" === typeof key && + RegExp(/(.*)_postfix$/).test(key) + ) return "string" === typeof value; if ( + "string" === typeof key && RegExp( - /^(value_[+-]?\d+(?:\.\d+)?(?:[eE][+-]?\d+)?)$/, + /^value_[+-]?\d+(?:\.\d+)?(?:[eE][+-]?\d+)?$/, ).test(key) ) return ( @@ -33,8 +40,9 @@ export const test_notation_validateSnake_DynamicTemplate = Number.isFinite(value) ); if ( + "string" === typeof key && RegExp( - /^(between_(.*)_and_[+-]?\d+(?:\.\d+)?(?:[eE][+-]?\d+)?)$/, + /^between_(.*)_and_[+-]?\d+(?:\.\d+)?(?:[eE][+-]?\d+)?$/, ).test(key) ) return "boolean" === typeof value; @@ -71,9 +79,10 @@ export const test_notation_validateSnake_DynamicTemplate = if (undefined === value) return true; if ( - RegExp( - /^(prefix_(.*))/, - ).test(key) + "string" === typeof key && + RegExp(/^prefix_(.*)/).test( + key, + ) ) return ( "string" === @@ -91,8 +100,9 @@ export const test_notation_validateSnake_DynamicTemplate = ) ); if ( + "string" === typeof key && RegExp( - /((.*)_postfix)$/, + /(.*)_postfix$/, ).test(key) ) return ( @@ -111,8 +121,9 @@ export const test_notation_validateSnake_DynamicTemplate = ) ); if ( + "string" === typeof key && RegExp( - /^(value_[+-]?\d+(?:\.\d+)?(?:[eE][+-]?\d+)?)$/, + /^value_[+-]?\d+(?:\.\d+)?(?:[eE][+-]?\d+)?$/, ).test(key) ) return ( @@ -134,8 +145,9 @@ export const test_notation_validateSnake_DynamicTemplate = ) ); if ( + "string" === typeof key && RegExp( - /^(between_(.*)_and_[+-]?\d+(?:\.\d+)?(?:[eE][+-]?\d+)?)$/, + /^between_(.*)_and_[+-]?\d+(?:\.\d+)?(?:[eE][+-]?\d+)?$/, ).test(key) ) return ( @@ -231,13 +243,20 @@ export const test_notation_validateSnake_DynamicTemplate = Object.keys(input).every((key: any) => { const value = input[key]; if (undefined === value) return true; - if (RegExp(/^(prefix_(.*))/).test(key)) + if ( + "string" === typeof key && + RegExp(/^prefix_(.*)/).test(key) + ) return "string" === typeof value; - if (RegExp(/((.*)_postfix)$/).test(key)) + if ( + "string" === typeof key && + RegExp(/(.*)_postfix$/).test(key) + ) return "string" === typeof value; if ( + "string" === typeof key && RegExp( - /^(value_[+-]?\d+(?:\.\d+)?(?:[eE][+-]?\d+)?)$/, + /^value_[+-]?\d+(?:\.\d+)?(?:[eE][+-]?\d+)?$/, ).test(key) ) return ( @@ -245,8 +264,9 @@ export const test_notation_validateSnake_DynamicTemplate = Number.isFinite(value) ); if ( + "string" === typeof key && RegExp( - /^(between_(.*)_and_[+-]?\d+(?:\.\d+)?(?:[eE][+-]?\d+)?)$/, + /^between_(.*)_and_[+-]?\d+(?:\.\d+)?(?:[eE][+-]?\d+)?$/, ).test(key) ) return "boolean" === typeof value; @@ -276,7 +296,10 @@ export const test_notation_validateSnake_DynamicTemplate = Object.keys(input).every((key: any) => { const value = input[key]; if (undefined === value) return true; - if (RegExp(/^(prefix_(.*))/).test(key)) + if ( + "string" === typeof key && + RegExp(/^prefix_(.*)/).test(key) + ) return ( "string" === typeof value || $guard(_exceptionable, { @@ -285,7 +308,10 @@ export const test_notation_validateSnake_DynamicTemplate = value: value, }) ); - if (RegExp(/((.*)_postfix)$/).test(key)) + if ( + "string" === typeof key && + RegExp(/(.*)_postfix$/).test(key) + ) return ( "string" === typeof value || $guard(_exceptionable, { @@ -295,8 +321,9 @@ export const test_notation_validateSnake_DynamicTemplate = }) ); if ( + "string" === typeof key && RegExp( - /^(value_[+-]?\d+(?:\.\d+)?(?:[eE][+-]?\d+)?)$/, + /^value_[+-]?\d+(?:\.\d+)?(?:[eE][+-]?\d+)?$/, ).test(key) ) return ( @@ -309,8 +336,9 @@ export const test_notation_validateSnake_DynamicTemplate = }) ); if ( + "string" === typeof key && RegExp( - /^(between_(.*)_and_[+-]?\d+(?:\.\d+)?(?:[eE][+-]?\d+)?)$/, + /^between_(.*)_and_[+-]?\d+(?:\.\d+)?(?:[eE][+-]?\d+)?$/, ).test(key) ) return ( diff --git a/test/generated/output/notation.snake/test_notation_snake_DynamicTree.ts b/test/generated/output/notation.snake/test_notation_snake_DynamicTree.ts index 5878b3f0b5..817f210792 100644 --- a/test/generated/output/notation.snake/test_notation_snake_DynamicTree.ts +++ b/test/generated/output/notation.snake/test_notation_snake_DynamicTree.ts @@ -25,7 +25,7 @@ export const test_notation_validateSnake_DynamicTree = Object.keys(input).every((key: any) => { const value = input[key]; if (undefined === value) return true; - if (RegExp(/(.*)/).test(key)) + if (true) return ( "object" === typeof value && null !== value && @@ -103,7 +103,7 @@ export const test_notation_validateSnake_DynamicTree = const value = input[key]; if (undefined === value) return true; - if (RegExp(/(.*)/).test(key)) + if (true) return ( ((("object" === typeof value && @@ -182,7 +182,7 @@ export const test_notation_validateSnake_DynamicTree = Object.keys(input).every((key: any) => { const value = input[key]; if (undefined === value) return true; - if (RegExp(/(.*)/).test(key)) + if (true) return ( "object" === typeof value && null !== value && @@ -236,7 +236,7 @@ export const test_notation_validateSnake_DynamicTree = Object.keys(input).every((key: any) => { const value = input[key]; if (undefined === value) return true; - if (RegExp(/(.*)/).test(key)) + if (true) return ( "object" === typeof value && null !== value && @@ -301,7 +301,7 @@ export const test_notation_validateSnake_DynamicTree = Object.keys(input).every((key: any) => { const value = input[key]; if (undefined === value) return true; - if (RegExp(/(.*)/).test(key)) + if (true) return ( ((("object" === typeof value && null !== value) || diff --git a/test/generated/output/notation.snake/test_notation_snake_DynamicUndefined.ts b/test/generated/output/notation.snake/test_notation_snake_DynamicUndefined.ts index 105f8194e4..8790ad2fb5 100644 --- a/test/generated/output/notation.snake/test_notation_snake_DynamicUndefined.ts +++ b/test/generated/output/notation.snake/test_notation_snake_DynamicUndefined.ts @@ -19,7 +19,7 @@ export const test_notation_validateSnake_DynamicUndefined = Object.keys(input).every((key: any) => { const value = input[key]; if (undefined === value) return true; - if (RegExp(/(.*)/).test(key)) + if (true) return ( null !== value && undefined === value ); @@ -55,7 +55,7 @@ export const test_notation_validateSnake_DynamicUndefined = const value = input[key]; if (undefined === value) return true; - if (RegExp(/(.*)/).test(key)) + if (true) return ( (null !== value || $report( @@ -144,8 +144,7 @@ export const test_notation_validateSnake_DynamicUndefined = Object.keys(input).every((key: any) => { const value = input[key]; if (undefined === value) return true; - if (RegExp(/(.*)/).test(key)) - return null !== value && undefined === value; + if (true) return null !== value && undefined === value; return true; }); return ( @@ -172,7 +171,7 @@ export const test_notation_validateSnake_DynamicUndefined = Object.keys(input).every((key: any) => { const value = input[key]; if (undefined === value) return true; - if (RegExp(/(.*)/).test(key)) + if (true) return ( (null !== value || $guard(_exceptionable, { diff --git a/test/generated/output/notation.snake/test_notation_snake_DynamicUnion.ts b/test/generated/output/notation.snake/test_notation_snake_DynamicUnion.ts index 0fd40b76df..2ffd640ff7 100644 --- a/test/generated/output/notation.snake/test_notation_snake_DynamicUnion.ts +++ b/test/generated/output/notation.snake/test_notation_snake_DynamicUnion.ts @@ -18,18 +18,24 @@ export const test_notation_validateSnake_DynamicUnion = const value = input[key]; if (undefined === value) return true; if ( - RegExp( - /^[+-]?\d+(?:\.\d+)?(?:[eE][+-]?\d+)?$/, - ).test(key) + "number" === typeof Number(key) && + Number.isFinite(Number(key)) ) return "string" === typeof value; - if (RegExp(/^(prefix_(.*))/).test(key)) + if ( + "string" === typeof key && + RegExp(/^prefix_(.*)/).test(key) + ) return "string" === typeof value; - if (RegExp(/((.*)_postfix)$/).test(key)) + if ( + "string" === typeof key && + RegExp(/(.*)_postfix$/).test(key) + ) return "string" === typeof value; if ( + "string" === typeof key && RegExp( - /^(value_between_[+-]?\d+(?:\.\d+)?(?:[eE][+-]?\d+)?_and_[+-]?\d+(?:\.\d+)?(?:[eE][+-]?\d+)?)$/, + /^value_between_[+-]?\d+(?:\.\d+)?(?:[eE][+-]?\d+)?_and_[+-]?\d+(?:\.\d+)?(?:[eE][+-]?\d+)?$/, ).test(key) ) return ( @@ -69,9 +75,9 @@ export const test_notation_validateSnake_DynamicUnion = if (undefined === value) return true; if ( - RegExp( - /^[+-]?\d+(?:\.\d+)?(?:[eE][+-]?\d+)?$/, - ).test(key) + "number" === + typeof Number(key) && + Number.isFinite(Number(key)) ) return ( "string" === @@ -89,9 +95,10 @@ export const test_notation_validateSnake_DynamicUnion = ) ); if ( - RegExp( - /^(prefix_(.*))/, - ).test(key) + "string" === typeof key && + RegExp(/^prefix_(.*)/).test( + key, + ) ) return ( "string" === @@ -109,8 +116,9 @@ export const test_notation_validateSnake_DynamicUnion = ) ); if ( + "string" === typeof key && RegExp( - /((.*)_postfix)$/, + /(.*)_postfix$/, ).test(key) ) return ( @@ -129,8 +137,9 @@ export const test_notation_validateSnake_DynamicUnion = ) ); if ( + "string" === typeof key && RegExp( - /^(value_between_[+-]?\d+(?:\.\d+)?(?:[eE][+-]?\d+)?_and_[+-]?\d+(?:\.\d+)?(?:[eE][+-]?\d+)?)$/, + /^value_between_[+-]?\d+(?:\.\d+)?(?:[eE][+-]?\d+)?_and_[+-]?\d+(?:\.\d+)?(?:[eE][+-]?\d+)?$/, ).test(key) ) return ( @@ -230,18 +239,24 @@ export const test_notation_validateSnake_DynamicUnion = const value = input[key]; if (undefined === value) return true; if ( - RegExp( - /^[+-]?\d+(?:\.\d+)?(?:[eE][+-]?\d+)?$/, - ).test(key) + "number" === typeof Number(key) && + Number.isFinite(Number(key)) ) return "string" === typeof value; - if (RegExp(/^(prefix_(.*))/).test(key)) + if ( + "string" === typeof key && + RegExp(/^prefix_(.*)/).test(key) + ) return "string" === typeof value; - if (RegExp(/((.*)_postfix)$/).test(key)) + if ( + "string" === typeof key && + RegExp(/(.*)_postfix$/).test(key) + ) return "string" === typeof value; if ( + "string" === typeof key && RegExp( - /^(value_between_[+-]?\d+(?:\.\d+)?(?:[eE][+-]?\d+)?_and_[+-]?\d+(?:\.\d+)?(?:[eE][+-]?\d+)?)$/, + /^value_between_[+-]?\d+(?:\.\d+)?(?:[eE][+-]?\d+)?_and_[+-]?\d+(?:\.\d+)?(?:[eE][+-]?\d+)?$/, ).test(key) ) return ( @@ -275,9 +290,8 @@ export const test_notation_validateSnake_DynamicUnion = const value = input[key]; if (undefined === value) return true; if ( - RegExp( - /^[+-]?\d+(?:\.\d+)?(?:[eE][+-]?\d+)?$/, - ).test(key) + "number" === typeof Number(key) && + Number.isFinite(Number(key)) ) return ( "string" === typeof value || @@ -287,7 +301,10 @@ export const test_notation_validateSnake_DynamicUnion = value: value, }) ); - if (RegExp(/^(prefix_(.*))/).test(key)) + if ( + "string" === typeof key && + RegExp(/^prefix_(.*)/).test(key) + ) return ( "string" === typeof value || $guard(_exceptionable, { @@ -296,7 +313,10 @@ export const test_notation_validateSnake_DynamicUnion = value: value, }) ); - if (RegExp(/((.*)_postfix)$/).test(key)) + if ( + "string" === typeof key && + RegExp(/(.*)_postfix$/).test(key) + ) return ( "string" === typeof value || $guard(_exceptionable, { @@ -306,8 +326,9 @@ export const test_notation_validateSnake_DynamicUnion = }) ); if ( + "string" === typeof key && RegExp( - /^(value_between_[+-]?\d+(?:\.\d+)?(?:[eE][+-]?\d+)?_and_[+-]?\d+(?:\.\d+)?(?:[eE][+-]?\d+)?)$/, + /^value_between_[+-]?\d+(?:\.\d+)?(?:[eE][+-]?\d+)?_and_[+-]?\d+(?:\.\d+)?(?:[eE][+-]?\d+)?$/, ).test(key) ) return ( diff --git a/test/generated/output/notation.snake/test_notation_snake_ObjectDynamic.ts b/test/generated/output/notation.snake/test_notation_snake_ObjectDynamic.ts index 06b22706de..f485d09521 100644 --- a/test/generated/output/notation.snake/test_notation_snake_ObjectDynamic.ts +++ b/test/generated/output/notation.snake/test_notation_snake_ObjectDynamic.ts @@ -19,7 +19,7 @@ export const test_notation_validateSnake_ObjectDynamic = Object.keys(input).every((key: any) => { const value = input[key]; if (undefined === value) return true; - if (RegExp(/(.*)/).test(key)) + if (true) return ( "string" === typeof value || ("number" === typeof value && @@ -58,7 +58,7 @@ export const test_notation_validateSnake_ObjectDynamic = const value = input[key]; if (undefined === value) return true; - if (RegExp(/(.*)/).test(key)) + if (true) return ( "string" === typeof value || @@ -139,7 +139,7 @@ export const test_notation_validateSnake_ObjectDynamic = Object.keys(input).every((key: any) => { const value = input[key]; if (undefined === value) return true; - if (RegExp(/(.*)/).test(key)) + if (true) return ( "string" === typeof value || ("number" === typeof value && @@ -172,7 +172,7 @@ export const test_notation_validateSnake_ObjectDynamic = Object.keys(input).every((key: any) => { const value = input[key]; if (undefined === value) return true; - if (RegExp(/(.*)/).test(key)) + if (true) return ( "string" === typeof value || ("number" === typeof value && diff --git a/test/generated/output/protobuf.assertDecode/test_protobuf_assertDecode_DynamicTree.ts b/test/generated/output/protobuf.assertDecode/test_protobuf_assertDecode_DynamicTree.ts index 6901b96943..ec9188364c 100644 --- a/test/generated/output/protobuf.assertDecode/test_protobuf_assertDecode_DynamicTree.ts +++ b/test/generated/output/protobuf.assertDecode/test_protobuf_assertDecode_DynamicTree.ts @@ -87,7 +87,7 @@ export const test_protobuf_createAssertDecode_DynamicTree = Object.keys(input).every((key: any) => { const value = input[key]; if (undefined === value) return true; - if (RegExp(/(.*)/).test(key)) + if (true) return ( "object" === typeof value && null !== value && @@ -156,7 +156,7 @@ export const test_protobuf_createAssertDecode_DynamicTree = Object.keys(input).every((key: any) => { const value = input[key]; if (undefined === value) return true; - if (RegExp(/(.*)/).test(key)) + if (true) return ( ((("object" === typeof value && null !== value) || @@ -235,7 +235,7 @@ export const test_protobuf_createAssertDecode_DynamicTree = Object.keys(input).every((key: any) => { const value = input[key]; if (undefined === value) return true; - if (RegExp(/(.*)/).test(key)) + if (true) return ( "object" === typeof value && null !== value && diff --git a/test/generated/output/protobuf.assertEncode/test_protobuf_assertEncode_DynamicTree.ts b/test/generated/output/protobuf.assertEncode/test_protobuf_assertEncode_DynamicTree.ts index 1ae5e8896b..99f6abf125 100644 --- a/test/generated/output/protobuf.assertEncode/test_protobuf_assertEncode_DynamicTree.ts +++ b/test/generated/output/protobuf.assertEncode/test_protobuf_assertEncode_DynamicTree.ts @@ -20,7 +20,7 @@ export const test_protobuf_createAssertEncode_DynamicTree = Object.keys(input).every((key: any) => { const value = input[key]; if (undefined === value) return true; - if (RegExp(/(.*)/).test(key)) + if (true) return ( "object" === typeof value && null !== value && @@ -89,7 +89,7 @@ export const test_protobuf_createAssertEncode_DynamicTree = Object.keys(input).every((key: any) => { const value = input[key]; if (undefined === value) return true; - if (RegExp(/(.*)/).test(key)) + if (true) return ( ((("object" === typeof value && null !== value) || @@ -167,7 +167,7 @@ export const test_protobuf_createAssertEncode_DynamicTree = Object.keys(input).every((key: any) => { const value = input[key]; if (undefined === value) return true; - if (RegExp(/(.*)/).test(key)) + if (true) return ( "object" === typeof value && null !== value && diff --git a/test/generated/output/protobuf.createAssertDecode/test_protobuf_createAssertDecode_DynamicTree.ts b/test/generated/output/protobuf.createAssertDecode/test_protobuf_createAssertDecode_DynamicTree.ts index 20f43c5489..7b2024d3ad 100644 --- a/test/generated/output/protobuf.createAssertDecode/test_protobuf_createAssertDecode_DynamicTree.ts +++ b/test/generated/output/protobuf.createAssertDecode/test_protobuf_createAssertDecode_DynamicTree.ts @@ -82,7 +82,7 @@ export const test_protobuf_createAssertDecode_DynamicTree = Object.keys(input).every((key: any) => { const value = input[key]; if (undefined === value) return true; - if (RegExp(/(.*)/).test(key)) + if (true) return ( "object" === typeof value && null !== value && @@ -152,7 +152,7 @@ export const test_protobuf_createAssertDecode_DynamicTree = Object.keys(input).every((key: any) => { const value = input[key]; if (undefined === value) return true; - if (RegExp(/(.*)/).test(key)) + if (true) return ( ((("object" === typeof value && null !== value) || @@ -230,7 +230,7 @@ export const test_protobuf_createAssertDecode_DynamicTree = Object.keys(input).every((key: any) => { const value = input[key]; if (undefined === value) return true; - if (RegExp(/(.*)/).test(key)) + if (true) return ( "object" === typeof value && null !== value && diff --git a/test/generated/output/protobuf.createAssertEncode/test_protobuf_createAssertEncode_DynamicTree.ts b/test/generated/output/protobuf.createAssertEncode/test_protobuf_createAssertEncode_DynamicTree.ts index 1822780496..d6a9bf0d75 100644 --- a/test/generated/output/protobuf.createAssertEncode/test_protobuf_createAssertEncode_DynamicTree.ts +++ b/test/generated/output/protobuf.createAssertEncode/test_protobuf_createAssertEncode_DynamicTree.ts @@ -19,7 +19,7 @@ export const test_protobuf_createAssertEncode_DynamicTree = Object.keys(input).every((key: any) => { const value = input[key]; if (undefined === value) return true; - if (RegExp(/(.*)/).test(key)) + if (true) return ( "object" === typeof value && null !== value && @@ -89,7 +89,7 @@ export const test_protobuf_createAssertEncode_DynamicTree = Object.keys(input).every((key: any) => { const value = input[key]; if (undefined === value) return true; - if (RegExp(/(.*)/).test(key)) + if (true) return ( ((("object" === typeof value && null !== value) || @@ -167,7 +167,7 @@ export const test_protobuf_createAssertEncode_DynamicTree = Object.keys(input).every((key: any) => { const value = input[key]; if (undefined === value) return true; - if (RegExp(/(.*)/).test(key)) + if (true) return ( "object" === typeof value && null !== value && diff --git a/test/generated/output/protobuf.createDecode/test_protobuf_createDecode_DynamicTree.ts b/test/generated/output/protobuf.createDecode/test_protobuf_createDecode_DynamicTree.ts index 95cbc722bc..191ae38d12 100644 --- a/test/generated/output/protobuf.createDecode/test_protobuf_createDecode_DynamicTree.ts +++ b/test/generated/output/protobuf.createDecode/test_protobuf_createDecode_DynamicTree.ts @@ -101,7 +101,7 @@ export const test_protobuf_createDecode_DynamicTree = _test_protobuf_decode( Object.keys(input).every((key: any) => { const value = input[key]; if (undefined === value) return true; - if (RegExp(/(.*)/).test(key)) + if (true) return ( "object" === typeof value && null !== value && diff --git a/test/generated/output/protobuf.createEncode/test_protobuf_createEncode_DynamicTree.ts b/test/generated/output/protobuf.createEncode/test_protobuf_createEncode_DynamicTree.ts index 31589e9e86..c2b40d97ec 100644 --- a/test/generated/output/protobuf.createEncode/test_protobuf_createEncode_DynamicTree.ts +++ b/test/generated/output/protobuf.createEncode/test_protobuf_createEncode_DynamicTree.ts @@ -41,7 +41,7 @@ export const test_protobuf_createEncode_DynamicTree = _test_protobuf_encode( Object.keys(input).every((key: any) => { const value = input[key]; if (undefined === value) return true; - if (RegExp(/(.*)/).test(key)) + if (true) return ( "object" === typeof value && null !== value && diff --git a/test/generated/output/protobuf.createIsDecode/test_protobuf_createIsDecode_DynamicTree.ts b/test/generated/output/protobuf.createIsDecode/test_protobuf_createIsDecode_DynamicTree.ts index 87fd71645e..4285b50ecf 100644 --- a/test/generated/output/protobuf.createIsDecode/test_protobuf_createIsDecode_DynamicTree.ts +++ b/test/generated/output/protobuf.createIsDecode/test_protobuf_createIsDecode_DynamicTree.ts @@ -19,7 +19,7 @@ export const test_protobuf_createIsDecode_DynamicTree = _test_protobuf_isDecode( Object.keys(input).every((key: any) => { const value = input[key]; if (undefined === value) return true; - if (RegExp(/(.*)/).test(key)) + if (true) return ( "object" === typeof value && null !== value && @@ -129,7 +129,7 @@ export const test_protobuf_createIsDecode_DynamicTree = _test_protobuf_isDecode( Object.keys(input).every((key: any) => { const value = input[key]; if (undefined === value) return true; - if (RegExp(/(.*)/).test(key)) + if (true) return ( "object" === typeof value && null !== value && diff --git a/test/generated/output/protobuf.createIsEncode/test_protobuf_createIsEncode_DynamicTree.ts b/test/generated/output/protobuf.createIsEncode/test_protobuf_createIsEncode_DynamicTree.ts index db73c84d08..bd0b5db2ba 100644 --- a/test/generated/output/protobuf.createIsEncode/test_protobuf_createIsEncode_DynamicTree.ts +++ b/test/generated/output/protobuf.createIsEncode/test_protobuf_createIsEncode_DynamicTree.ts @@ -19,7 +19,7 @@ export const test_protobuf_createIsEncode_DynamicTree = _test_protobuf_isEncode( Object.keys(input).every((key: any) => { const value = input[key]; if (undefined === value) return true; - if (RegExp(/(.*)/).test(key)) + if (true) return ( "object" === typeof value && null !== value && @@ -65,7 +65,7 @@ export const test_protobuf_createIsEncode_DynamicTree = _test_protobuf_isEncode( Object.keys(input).every((key: any) => { const value = input[key]; if (undefined === value) return true; - if (RegExp(/(.*)/).test(key)) + if (true) return ( "object" === typeof value && null !== value && diff --git a/test/generated/output/protobuf.createValidateDecode/test_protobuf_createValidateDecode_DynamicTree.ts b/test/generated/output/protobuf.createValidateDecode/test_protobuf_createValidateDecode_DynamicTree.ts index 9358e57d55..cb0064262b 100644 --- a/test/generated/output/protobuf.createValidateDecode/test_protobuf_createValidateDecode_DynamicTree.ts +++ b/test/generated/output/protobuf.createValidateDecode/test_protobuf_createValidateDecode_DynamicTree.ts @@ -22,7 +22,7 @@ export const test_protobuf_createValidateDecode_DynamicTree = Object.keys(input).every((key: any) => { const value = input[key]; if (undefined === value) return true; - if (RegExp(/(.*)/).test(key)) + if (true) return ( "object" === typeof value && null !== value && @@ -98,7 +98,7 @@ export const test_protobuf_createValidateDecode_DynamicTree = const value = input[key]; if (undefined === value) return true; - if (RegExp(/(.*)/).test(key)) + if (true) return ( ((("object" === typeof value && @@ -256,7 +256,7 @@ export const test_protobuf_createValidateDecode_DynamicTree = Object.keys(input).every((key: any) => { const value = input[key]; if (undefined === value) return true; - if (RegExp(/(.*)/).test(key)) + if (true) return ( "object" === typeof value && null !== value && diff --git a/test/generated/output/protobuf.createValidateEncode/test_protobuf_createValidateEncode_DynamicTree.ts b/test/generated/output/protobuf.createValidateEncode/test_protobuf_createValidateEncode_DynamicTree.ts index 374f65ba5b..2019d7ca61 100644 --- a/test/generated/output/protobuf.createValidateEncode/test_protobuf_createValidateEncode_DynamicTree.ts +++ b/test/generated/output/protobuf.createValidateEncode/test_protobuf_createValidateEncode_DynamicTree.ts @@ -20,7 +20,7 @@ export const test_protobuf_createValidateEncode_DynamicTree = Object.keys(input).every((key: any) => { const value = input[key]; if (undefined === value) return true; - if (RegExp(/(.*)/).test(key)) + if (true) return ( "object" === typeof value && null !== value && @@ -96,7 +96,7 @@ export const test_protobuf_createValidateEncode_DynamicTree = const value = input[key]; if (undefined === value) return true; - if (RegExp(/(.*)/).test(key)) + if (true) return ( ((("object" === typeof value && @@ -192,7 +192,7 @@ export const test_protobuf_createValidateEncode_DynamicTree = Object.keys(input).every((key: any) => { const value = input[key]; if (undefined === value) return true; - if (RegExp(/(.*)/).test(key)) + if (true) return ( "object" === typeof value && null !== value && diff --git a/test/generated/output/protobuf.decode/test_protobuf_decode_DynamicTree.ts b/test/generated/output/protobuf.decode/test_protobuf_decode_DynamicTree.ts index 7d6d6d54a5..a9061ef313 100644 --- a/test/generated/output/protobuf.decode/test_protobuf_decode_DynamicTree.ts +++ b/test/generated/output/protobuf.decode/test_protobuf_decode_DynamicTree.ts @@ -102,7 +102,7 @@ export const test_protobuf_createDecode_DynamicTree = _test_protobuf_decode( Object.keys(input).every((key: any) => { const value = input[key]; if (undefined === value) return true; - if (RegExp(/(.*)/).test(key)) + if (true) return ( "object" === typeof value && null !== value && diff --git a/test/generated/output/protobuf.encode/test_protobuf_encode_DynamicTree.ts b/test/generated/output/protobuf.encode/test_protobuf_encode_DynamicTree.ts index c37ed4d1aa..455e306939 100644 --- a/test/generated/output/protobuf.encode/test_protobuf_encode_DynamicTree.ts +++ b/test/generated/output/protobuf.encode/test_protobuf_encode_DynamicTree.ts @@ -42,7 +42,7 @@ export const test_protobuf_createEncode_DynamicTree = _test_protobuf_encode( Object.keys(input).every((key: any) => { const value = input[key]; if (undefined === value) return true; - if (RegExp(/(.*)/).test(key)) + if (true) return ( "object" === typeof value && null !== value && diff --git a/test/generated/output/protobuf.isDecode/test_protobuf_isDecode_DynamicTree.ts b/test/generated/output/protobuf.isDecode/test_protobuf_isDecode_DynamicTree.ts index 6de75e10fd..35e6e86ce7 100644 --- a/test/generated/output/protobuf.isDecode/test_protobuf_isDecode_DynamicTree.ts +++ b/test/generated/output/protobuf.isDecode/test_protobuf_isDecode_DynamicTree.ts @@ -20,7 +20,7 @@ export const test_protobuf_createIsDecode_DynamicTree = _test_protobuf_isDecode( Object.keys(input).every((key: any) => { const value = input[key]; if (undefined === value) return true; - if (RegExp(/(.*)/).test(key)) + if (true) return ( "object" === typeof value && null !== value && @@ -134,7 +134,7 @@ export const test_protobuf_createIsDecode_DynamicTree = _test_protobuf_isDecode( Object.keys(input).every((key: any) => { const value = input[key]; if (undefined === value) return true; - if (RegExp(/(.*)/).test(key)) + if (true) return ( "object" === typeof value && null !== value && diff --git a/test/generated/output/protobuf.isEncode/test_protobuf_isEncode_DynamicTree.ts b/test/generated/output/protobuf.isEncode/test_protobuf_isEncode_DynamicTree.ts index 1eaceb2dfa..c028341831 100644 --- a/test/generated/output/protobuf.isEncode/test_protobuf_isEncode_DynamicTree.ts +++ b/test/generated/output/protobuf.isEncode/test_protobuf_isEncode_DynamicTree.ts @@ -20,7 +20,7 @@ export const test_protobuf_createIsEncode_DynamicTree = _test_protobuf_isEncode( Object.keys(input).every((key: any) => { const value = input[key]; if (undefined === value) return true; - if (RegExp(/(.*)/).test(key)) + if (true) return ( "object" === typeof value && null !== value && @@ -70,7 +70,7 @@ export const test_protobuf_createIsEncode_DynamicTree = _test_protobuf_isEncode( Object.keys(input).every((key: any) => { const value = input[key]; if (undefined === value) return true; - if (RegExp(/(.*)/).test(key)) + if (true) return ( "object" === typeof value && null !== value && diff --git a/test/generated/output/protobuf.validateDecode/test_protobuf_validateDecode_DynamicTree.ts b/test/generated/output/protobuf.validateDecode/test_protobuf_validateDecode_DynamicTree.ts index 41430a657d..10344e938b 100644 --- a/test/generated/output/protobuf.validateDecode/test_protobuf_validateDecode_DynamicTree.ts +++ b/test/generated/output/protobuf.validateDecode/test_protobuf_validateDecode_DynamicTree.ts @@ -25,7 +25,7 @@ export const test_protobuf_createValidateDecode_DynamicTree = Object.keys(input).every((key: any) => { const value = input[key]; if (undefined === value) return true; - if (RegExp(/(.*)/).test(key)) + if (true) return ( "object" === typeof value && null !== value && @@ -103,7 +103,7 @@ export const test_protobuf_createValidateDecode_DynamicTree = const value = input[key]; if (undefined === value) return true; - if (RegExp(/(.*)/).test(key)) + if (true) return ( ((("object" === typeof value && @@ -275,7 +275,7 @@ export const test_protobuf_createValidateDecode_DynamicTree = Object.keys(input).every((key: any) => { const value = input[key]; if (undefined === value) return true; - if (RegExp(/(.*)/).test(key)) + if (true) return ( "object" === typeof value && null !== value && diff --git a/test/generated/output/protobuf.validateEncode/test_protobuf_validateEncode_DynamicTree.ts b/test/generated/output/protobuf.validateEncode/test_protobuf_validateEncode_DynamicTree.ts index 11e82c45b6..9cfb2f1a0f 100644 --- a/test/generated/output/protobuf.validateEncode/test_protobuf_validateEncode_DynamicTree.ts +++ b/test/generated/output/protobuf.validateEncode/test_protobuf_validateEncode_DynamicTree.ts @@ -23,7 +23,7 @@ export const test_protobuf_createValidateEncode_DynamicTree = Object.keys(input).every((key: any) => { const value = input[key]; if (undefined === value) return true; - if (RegExp(/(.*)/).test(key)) + if (true) return ( "object" === typeof value && null !== value && @@ -101,7 +101,7 @@ export const test_protobuf_createValidateEncode_DynamicTree = const value = input[key]; if (undefined === value) return true; - if (RegExp(/(.*)/).test(key)) + if (true) return ( ((("object" === typeof value && @@ -205,7 +205,7 @@ export const test_protobuf_createValidateEncode_DynamicTree = Object.keys(input).every((key: any) => { const value = input[key]; if (undefined === value) return true; - if (RegExp(/(.*)/).test(key)) + if (true) return ( "object" === typeof value && null !== value && diff --git a/test/generated/output/random/test_random_DynamicComposite.ts b/test/generated/output/random/test_random_DynamicComposite.ts index ebe0f6bc7e..91ec3c4669 100644 --- a/test/generated/output/random/test_random_DynamicComposite.ts +++ b/test/generated/output/random/test_random_DynamicComposite.ts @@ -130,20 +130,26 @@ export const test_random_DynamicComposite = _test_random( const value = input[key]; if (undefined === value) return true; if ( - RegExp(/^[+-]?\d+(?:\.\d+)?(?:[eE][+-]?\d+)?$/).test( - key, - ) + "number" === typeof Number(key) && + Number.isFinite(Number(key)) ) return ( "number" === typeof value && Number.isFinite(value) ); - if (RegExp(/^(prefix_(.*))/).test(key)) + if ( + "string" === typeof key && + RegExp(/^prefix_(.*)/).test(key) + ) return "string" === typeof value; - if (RegExp(/((.*)_postfix)$/).test(key)) + if ( + "string" === typeof key && + RegExp(/(.*)_postfix$/).test(key) + ) return "string" === typeof value; if ( + "string" === typeof key && RegExp( - /^(value_[+-]?\d+(?:\.\d+)?(?:[eE][+-]?\d+)?)$/, + /^value_[+-]?\d+(?:\.\d+)?(?:[eE][+-]?\d+)?$/, ).test(key) ) return ( @@ -153,8 +159,9 @@ export const test_random_DynamicComposite = _test_random( "boolean" === typeof value ); if ( + "string" === typeof key && RegExp( - /^(between_(.*)_and_[+-]?\d+(?:\.\d+)?(?:[eE][+-]?\d+)?)$/, + /^between_(.*)_and_[+-]?\d+(?:\.\d+)?(?:[eE][+-]?\d+)?$/, ).test(key) ) return "boolean" === typeof value; @@ -196,9 +203,8 @@ export const test_random_DynamicComposite = _test_random( const value = input[key]; if (undefined === value) return true; if ( - RegExp( - /^[+-]?\d+(?:\.\d+)?(?:[eE][+-]?\d+)?$/, - ).test(key) + "number" === typeof Number(key) && + Number.isFinite(Number(key)) ) return ( ("number" === typeof value && @@ -209,7 +215,10 @@ export const test_random_DynamicComposite = _test_random( value: value, }) ); - if (RegExp(/^(prefix_(.*))/).test(key)) + if ( + "string" === typeof key && + RegExp(/^prefix_(.*)/).test(key) + ) return ( "string" === typeof value || $guard(_exceptionable, { @@ -218,7 +227,10 @@ export const test_random_DynamicComposite = _test_random( value: value, }) ); - if (RegExp(/((.*)_postfix)$/).test(key)) + if ( + "string" === typeof key && + RegExp(/(.*)_postfix$/).test(key) + ) return ( "string" === typeof value || $guard(_exceptionable, { @@ -228,8 +240,9 @@ export const test_random_DynamicComposite = _test_random( }) ); if ( + "string" === typeof key && RegExp( - /^(value_[+-]?\d+(?:\.\d+)?(?:[eE][+-]?\d+)?)$/, + /^value_[+-]?\d+(?:\.\d+)?(?:[eE][+-]?\d+)?$/, ).test(key) ) return ( @@ -244,8 +257,9 @@ export const test_random_DynamicComposite = _test_random( }) ); if ( + "string" === typeof key && RegExp( - /^(between_(.*)_and_[+-]?\d+(?:\.\d+)?(?:[eE][+-]?\d+)?)$/, + /^between_(.*)_and_[+-]?\d+(?:\.\d+)?(?:[eE][+-]?\d+)?$/, ).test(key) ) return ( diff --git a/test/generated/output/random/test_random_DynamicJsonValue.ts b/test/generated/output/random/test_random_DynamicJsonValue.ts index b315232a35..280ee52508 100644 --- a/test/generated/output/random/test_random_DynamicJsonValue.ts +++ b/test/generated/output/random/test_random_DynamicJsonValue.ts @@ -128,7 +128,7 @@ export const test_random_DynamicJsonValue = _test_random( Object.keys(input).every((key: any) => { const value = input[key]; if (undefined === value) return true; - if (RegExp(/(.*)/).test(key)) + if (true) return ( null === value || undefined === value || @@ -189,7 +189,7 @@ export const test_random_DynamicJsonValue = _test_random( Object.keys(input).every((key: any) => { const value = input[key]; if (undefined === value) return true; - if (RegExp(/(.*)/).test(key)) + if (true) return ( null === value || undefined === value || diff --git a/test/generated/output/random/test_random_DynamicNever.ts b/test/generated/output/random/test_random_DynamicNever.ts index 4b94f7a652..e97b69aabe 100644 --- a/test/generated/output/random/test_random_DynamicNever.ts +++ b/test/generated/output/random/test_random_DynamicNever.ts @@ -35,8 +35,7 @@ export const test_random_DynamicNever = _test_random( Object.keys(input).every((key: any) => { const value = input[key]; if (undefined === value) return true; - if (RegExp(/(.*)/).test(key)) - return null !== value && undefined === value; + if (true) return null !== value && undefined === value; return true; }); return ( @@ -63,7 +62,7 @@ export const test_random_DynamicNever = _test_random( Object.keys(input).every((key: any) => { const value = input[key]; if (undefined === value) return true; - if (RegExp(/(.*)/).test(key)) + if (true) return ( (null !== value || $guard(_exceptionable, { diff --git a/test/generated/output/random/test_random_DynamicTag.ts b/test/generated/output/random/test_random_DynamicTag.ts new file mode 100644 index 0000000000..e069a94698 --- /dev/null +++ b/test/generated/output/random/test_random_DynamicTag.ts @@ -0,0 +1,193 @@ +import typia from "../../../../src"; +import { _test_random } from "../../../internal/_test_random"; +import { DynamicTag } from "../../../structures/DynamicTag"; + +export const test_random_DynamicTag = _test_random("DynamicTag")( + DynamicTag, +)({ + random: () => + (( + generator?: Partial, + ): typia.Resolved => { + const $generator = (typia.random as any).generator; + const $ro0 = ( + _recursive: boolean = false, + _depth: number = 0, + ): any => { + const output = {} as any; + (generator?.array ?? $generator.array)( + () => + (output[ + ( + generator?.customs ?? $generator.customs + )?.number?.([ + { + name: "Minimum<0>", + kind: "minimum", + value: 0, + }, + { + name: "ExclusiveMaximum<10>", + kind: "exclusiveMaximum", + value: 10, + }, + ]) ?? + (generator?.number ?? $generator.number)(0, 10) + ] = + ( + generator?.customs ?? $generator.customs + )?.bigint?.([ + { + name: 'Type<"uint64">', + kind: "type", + value: "uint64", + }, + ]) ?? + (generator?.bigint ?? $generator.bigint)( + BigInt(0), + BigInt(10), + )), + (generator?.integer ?? $generator.integer)(0, 3), + ); + (generator?.array ?? $generator.array)( + () => + (output[ + ( + generator?.customs ?? $generator.customs + )?.string?.([ + { + name: 'Format<"uuid">', + kind: "format", + value: "uuid", + }, + ]) ?? (generator?.uuid ?? $generator.uuid)() + ] = + ( + generator?.customs ?? $generator.customs + )?.string?.([ + { + name: 'Format<"email">', + kind: "format", + value: "email", + }, + ]) ?? (generator?.email ?? $generator.email)()), + (generator?.integer ?? $generator.integer)(0, 3), + ); + return output; + }; + return $ro0(); + })((DynamicTag as any).RANDOM), + assert: (input: any): DynamicTag => { + const __is = (input: any): input is DynamicTag => { + const $io0 = (input: any): boolean => + Object.keys(input).every((key: any) => { + const value = input[key]; + if (undefined === value) return true; + if ( + "number" === typeof Number(key) && + 0 <= Number(key) && + Number(key) < 10 + ) + return "bigint" === typeof value && BigInt(0) <= value; + if ( + "string" === typeof key && + /^(?:[0-9a-f]{8}-[0-9a-f]{4}-[1-5][0-9a-f]{3}-[89ab][0-9a-f]{3}-[0-9a-f]{12}|00000000-0000-0000-0000-000000000000)$/i.test( + key, + ) + ) + return ( + "string" === typeof value && + /^(([^<>()[\]\.,;:\s@\"]+(\.[^<>()[\]\.,;:\s@\"]+)*)|(\".+\"))@(([^<>()[\]\.,;:\s@\"]+\.)+[^<>()[\]\.,;:\s@\"]{2,})$/i.test( + value, + ) + ); + return true; + }); + return ( + "object" === typeof input && + null !== input && + false === Array.isArray(input) && + $io0(input) + ); + }; + if (false === __is(input)) + (( + input: any, + _path: string, + _exceptionable: boolean = true, + ): input is DynamicTag => { + const $guard = (typia.createAssert as any).guard; + const $join = (typia.createAssert as any).join; + const $ao0 = ( + input: any, + _path: string, + _exceptionable: boolean = true, + ): boolean => + false === _exceptionable || + Object.keys(input).every((key: any) => { + const value = input[key]; + if (undefined === value) return true; + if ( + "number" === typeof Number(key) && + 0 <= Number(key) && + Number(key) < 10 + ) + return ( + ("bigint" === typeof value && + (BigInt(0) <= value || + $guard(_exceptionable, { + path: _path + $join(key), + expected: 'bigint & Type<"uint64">', + value: value, + }))) || + $guard(_exceptionable, { + path: _path + $join(key), + expected: '(bigint & Type<"uint64">)', + value: value, + }) + ); + if ( + "string" === typeof key && + /^(?:[0-9a-f]{8}-[0-9a-f]{4}-[1-5][0-9a-f]{3}-[89ab][0-9a-f]{3}-[0-9a-f]{12}|00000000-0000-0000-0000-000000000000)$/i.test( + key, + ) + ) + return ( + ("string" === typeof value && + (/^(([^<>()[\]\.,;:\s@\"]+(\.[^<>()[\]\.,;:\s@\"]+)*)|(\".+\"))@(([^<>()[\]\.,;:\s@\"]+\.)+[^<>()[\]\.,;:\s@\"]{2,})$/i.test( + value, + ) || + $guard(_exceptionable, { + path: _path + $join(key), + expected: + 'string & Format<"email">', + value: value, + }))) || + $guard(_exceptionable, { + path: _path + $join(key), + expected: '(string & Format<"email">)', + value: value, + }) + ); + return true; + }); + return ( + ((("object" === typeof input && + null !== input && + false === Array.isArray(input)) || + $guard(true, { + path: _path + "", + expected: "DynamicTag", + value: input, + })) && + $ao0(input, _path + "", true)) || + $guard(true, { + path: _path + "", + expected: "DynamicTag", + value: input, + }) + ); + })(input, "$input", true); + return input; + }, +}); diff --git a/test/generated/output/random/test_random_DynamicTemplate.ts b/test/generated/output/random/test_random_DynamicTemplate.ts index 490a03a722..8dfdcead5a 100644 --- a/test/generated/output/random/test_random_DynamicTemplate.ts +++ b/test/generated/output/random/test_random_DynamicTemplate.ts @@ -90,21 +90,29 @@ export const test_random_DynamicTemplate = _test_random( Object.keys(input).every((key: any) => { const value = input[key]; if (undefined === value) return true; - if (RegExp(/^(prefix_(.*))/).test(key)) + if ( + "string" === typeof key && + RegExp(/^prefix_(.*)/).test(key) + ) return "string" === typeof value; - if (RegExp(/((.*)_postfix)$/).test(key)) + if ( + "string" === typeof key && + RegExp(/(.*)_postfix$/).test(key) + ) return "string" === typeof value; if ( + "string" === typeof key && RegExp( - /^(value_[+-]?\d+(?:\.\d+)?(?:[eE][+-]?\d+)?)$/, + /^value_[+-]?\d+(?:\.\d+)?(?:[eE][+-]?\d+)?$/, ).test(key) ) return ( "number" === typeof value && Number.isFinite(value) ); if ( + "string" === typeof key && RegExp( - /^(between_(.*)_and_[+-]?\d+(?:\.\d+)?(?:[eE][+-]?\d+)?)$/, + /^between_(.*)_and_[+-]?\d+(?:\.\d+)?(?:[eE][+-]?\d+)?$/, ).test(key) ) return "boolean" === typeof value; @@ -134,7 +142,10 @@ export const test_random_DynamicTemplate = _test_random( Object.keys(input).every((key: any) => { const value = input[key]; if (undefined === value) return true; - if (RegExp(/^(prefix_(.*))/).test(key)) + if ( + "string" === typeof key && + RegExp(/^prefix_(.*)/).test(key) + ) return ( "string" === typeof value || $guard(_exceptionable, { @@ -143,7 +154,10 @@ export const test_random_DynamicTemplate = _test_random( value: value, }) ); - if (RegExp(/((.*)_postfix)$/).test(key)) + if ( + "string" === typeof key && + RegExp(/(.*)_postfix$/).test(key) + ) return ( "string" === typeof value || $guard(_exceptionable, { @@ -153,8 +167,9 @@ export const test_random_DynamicTemplate = _test_random( }) ); if ( + "string" === typeof key && RegExp( - /^(value_[+-]?\d+(?:\.\d+)?(?:[eE][+-]?\d+)?)$/, + /^value_[+-]?\d+(?:\.\d+)?(?:[eE][+-]?\d+)?$/, ).test(key) ) return ( @@ -167,8 +182,9 @@ export const test_random_DynamicTemplate = _test_random( }) ); if ( + "string" === typeof key && RegExp( - /^(between_(.*)_and_[+-]?\d+(?:\.\d+)?(?:[eE][+-]?\d+)?)$/, + /^between_(.*)_and_[+-]?\d+(?:\.\d+)?(?:[eE][+-]?\d+)?$/, ).test(key) ) return ( diff --git a/test/generated/output/random/test_random_DynamicTree.ts b/test/generated/output/random/test_random_DynamicTree.ts index 97c4dc3dbd..159a5cfcb0 100644 --- a/test/generated/output/random/test_random_DynamicTree.ts +++ b/test/generated/output/random/test_random_DynamicTree.ts @@ -57,7 +57,7 @@ export const test_random_DynamicTree = _test_random("DynamicTree")( Object.keys(input).every((key: any) => { const value = input[key]; if (undefined === value) return true; - if (RegExp(/(.*)/).test(key)) + if (true) return ( "object" === typeof value && null !== value && @@ -120,7 +120,7 @@ export const test_random_DynamicTree = _test_random("DynamicTree")( Object.keys(input).every((key: any) => { const value = input[key]; if (undefined === value) return true; - if (RegExp(/(.*)/).test(key)) + if (true) return ( ((("object" === typeof value && null !== value) || diff --git a/test/generated/output/random/test_random_DynamicUndefined.ts b/test/generated/output/random/test_random_DynamicUndefined.ts index 2cef8b652e..f25c1ab354 100644 --- a/test/generated/output/random/test_random_DynamicUndefined.ts +++ b/test/generated/output/random/test_random_DynamicUndefined.ts @@ -35,8 +35,7 @@ export const test_random_DynamicUndefined = _test_random( Object.keys(input).every((key: any) => { const value = input[key]; if (undefined === value) return true; - if (RegExp(/(.*)/).test(key)) - return null !== value && undefined === value; + if (true) return null !== value && undefined === value; return true; }); return ( @@ -63,7 +62,7 @@ export const test_random_DynamicUndefined = _test_random( Object.keys(input).every((key: any) => { const value = input[key]; if (undefined === value) return true; - if (RegExp(/(.*)/).test(key)) + if (true) return ( (null !== value || $guard(_exceptionable, { diff --git a/test/generated/output/random/test_random_DynamicUnion.ts b/test/generated/output/random/test_random_DynamicUnion.ts index e052c2993a..f78c0b90b8 100644 --- a/test/generated/output/random/test_random_DynamicUnion.ts +++ b/test/generated/output/random/test_random_DynamicUnion.ts @@ -93,18 +93,24 @@ export const test_random_DynamicUnion = _test_random( const value = input[key]; if (undefined === value) return true; if ( - RegExp(/^[+-]?\d+(?:\.\d+)?(?:[eE][+-]?\d+)?$/).test( - key, - ) + "number" === typeof Number(key) && + Number.isFinite(Number(key)) ) return "string" === typeof value; - if (RegExp(/^(prefix_(.*))/).test(key)) + if ( + "string" === typeof key && + RegExp(/^prefix_(.*)/).test(key) + ) return "string" === typeof value; - if (RegExp(/((.*)_postfix)$/).test(key)) + if ( + "string" === typeof key && + RegExp(/(.*)_postfix$/).test(key) + ) return "string" === typeof value; if ( + "string" === typeof key && RegExp( - /^(value_between_[+-]?\d+(?:\.\d+)?(?:[eE][+-]?\d+)?_and_[+-]?\d+(?:\.\d+)?(?:[eE][+-]?\d+)?)$/, + /^value_between_[+-]?\d+(?:\.\d+)?(?:[eE][+-]?\d+)?_and_[+-]?\d+(?:\.\d+)?(?:[eE][+-]?\d+)?$/, ).test(key) ) return ( @@ -137,9 +143,8 @@ export const test_random_DynamicUnion = _test_random( const value = input[key]; if (undefined === value) return true; if ( - RegExp( - /^[+-]?\d+(?:\.\d+)?(?:[eE][+-]?\d+)?$/, - ).test(key) + "number" === typeof Number(key) && + Number.isFinite(Number(key)) ) return ( "string" === typeof value || @@ -149,7 +154,10 @@ export const test_random_DynamicUnion = _test_random( value: value, }) ); - if (RegExp(/^(prefix_(.*))/).test(key)) + if ( + "string" === typeof key && + RegExp(/^prefix_(.*)/).test(key) + ) return ( "string" === typeof value || $guard(_exceptionable, { @@ -158,7 +166,10 @@ export const test_random_DynamicUnion = _test_random( value: value, }) ); - if (RegExp(/((.*)_postfix)$/).test(key)) + if ( + "string" === typeof key && + RegExp(/(.*)_postfix$/).test(key) + ) return ( "string" === typeof value || $guard(_exceptionable, { @@ -168,8 +179,9 @@ export const test_random_DynamicUnion = _test_random( }) ); if ( + "string" === typeof key && RegExp( - /^(value_between_[+-]?\d+(?:\.\d+)?(?:[eE][+-]?\d+)?_and_[+-]?\d+(?:\.\d+)?(?:[eE][+-]?\d+)?)$/, + /^value_between_[+-]?\d+(?:\.\d+)?(?:[eE][+-]?\d+)?_and_[+-]?\d+(?:\.\d+)?(?:[eE][+-]?\d+)?$/, ).test(key) ) return ( diff --git a/test/generated/output/random/test_random_ObjectDynamic.ts b/test/generated/output/random/test_random_ObjectDynamic.ts index eba4e2ff45..e6f634f804 100644 --- a/test/generated/output/random/test_random_ObjectDynamic.ts +++ b/test/generated/output/random/test_random_ObjectDynamic.ts @@ -51,7 +51,7 @@ export const test_random_ObjectDynamic = _test_random( Object.keys(input).every((key: any) => { const value = input[key]; if (undefined === value) return true; - if (RegExp(/(.*)/).test(key)) + if (true) return ( "string" === typeof value || ("number" === typeof value && @@ -84,7 +84,7 @@ export const test_random_ObjectDynamic = _test_random( Object.keys(input).every((key: any) => { const value = input[key]; if (undefined === value) return true; - if (RegExp(/(.*)/).test(key)) + if (true) return ( "string" === typeof value || ("number" === typeof value && diff --git a/test/generated/output/random/test_random_UltimateUnion.ts b/test/generated/output/random/test_random_UltimateUnion.ts index a7cdbfcbe6..b9f8fb36af 100644 --- a/test/generated/output/random/test_random_UltimateUnion.ts +++ b/test/generated/output/random/test_random_UltimateUnion.ts @@ -2949,7 +2949,7 @@ export const test_random_UltimateUnion = _test_random( Object.keys(input).every((key: any) => { const value = input[key]; if (undefined === value) return true; - if (RegExp(/(.*)/).test(key)) + if (true) return ( "object" === typeof value && null !== value && @@ -3011,7 +3011,7 @@ export const test_random_UltimateUnion = _test_random( Object.keys(input).every((key: any) => { const value = input[key]; if (undefined === value) return true; - if (RegExp(/(.*)/).test(key)) + if (true) return ( "object" === typeof value && null !== value && @@ -5747,7 +5747,7 @@ export const test_random_UltimateUnion = _test_random( Object.keys(input).every((key: any) => { const value = input[key]; if (undefined === value) return true; - if (RegExp(/(.*)/).test(key)) + if (true) return ( ((("object" === typeof value && null !== value && @@ -5993,7 +5993,7 @@ export const test_random_UltimateUnion = _test_random( Object.keys(input).every((key: any) => { const value = input[key]; if (undefined === value) return true; - if (RegExp(/(.*)/).test(key)) + if (true) return ( ((("object" === typeof value && null !== value && diff --git a/test/generated/output/validate/test_validate_DynamicComposite.ts b/test/generated/output/validate/test_validate_DynamicComposite.ts index 97870fffed..c135656d77 100644 --- a/test/generated/output/validate/test_validate_DynamicComposite.ts +++ b/test/generated/output/validate/test_validate_DynamicComposite.ts @@ -17,20 +17,26 @@ export const test_validate_DynamicComposite = _test_validate( const value = input[key]; if (undefined === value) return true; if ( - RegExp(/^[+-]?\d+(?:\.\d+)?(?:[eE][+-]?\d+)?$/).test( - key, - ) + "number" === typeof Number(key) && + Number.isFinite(Number(key)) ) return ( "number" === typeof value && Number.isFinite(value) ); - if (RegExp(/^(prefix_(.*))/).test(key)) + if ( + "string" === typeof key && + RegExp(/^prefix_(.*)/).test(key) + ) return "string" === typeof value; - if (RegExp(/((.*)_postfix)$/).test(key)) + if ( + "string" === typeof key && + RegExp(/(.*)_postfix$/).test(key) + ) return "string" === typeof value; if ( + "string" === typeof key && RegExp( - /^(value_[+-]?\d+(?:\.\d+)?(?:[eE][+-]?\d+)?)$/, + /^value_[+-]?\d+(?:\.\d+)?(?:[eE][+-]?\d+)?$/, ).test(key) ) return ( @@ -40,8 +46,9 @@ export const test_validate_DynamicComposite = _test_validate( "boolean" === typeof value ); if ( + "string" === typeof key && RegExp( - /^(between_(.*)_and_[+-]?\d+(?:\.\d+)?(?:[eE][+-]?\d+)?)$/, + /^between_(.*)_and_[+-]?\d+(?:\.\d+)?(?:[eE][+-]?\d+)?$/, ).test(key) ) return "boolean" === typeof value; @@ -87,9 +94,8 @@ export const test_validate_DynamicComposite = _test_validate( const value = input[key]; if (undefined === value) return true; if ( - RegExp( - /^[+-]?\d+(?:\.\d+)?(?:[eE][+-]?\d+)?$/, - ).test(key) + "number" === typeof Number(key) && + Number.isFinite(Number(key)) ) return ( ("number" === typeof value && @@ -100,7 +106,10 @@ export const test_validate_DynamicComposite = _test_validate( value: value, }) ); - if (RegExp(/^(prefix_(.*))/).test(key)) + if ( + "string" === typeof key && + RegExp(/^prefix_(.*)/).test(key) + ) return ( "string" === typeof value || $report(_exceptionable, { @@ -109,7 +118,10 @@ export const test_validate_DynamicComposite = _test_validate( value: value, }) ); - if (RegExp(/((.*)_postfix)$/).test(key)) + if ( + "string" === typeof key && + RegExp(/(.*)_postfix$/).test(key) + ) return ( "string" === typeof value || $report(_exceptionable, { @@ -119,8 +131,9 @@ export const test_validate_DynamicComposite = _test_validate( }) ); if ( + "string" === typeof key && RegExp( - /^(value_[+-]?\d+(?:\.\d+)?(?:[eE][+-]?\d+)?)$/, + /^value_[+-]?\d+(?:\.\d+)?(?:[eE][+-]?\d+)?$/, ).test(key) ) return ( @@ -136,8 +149,9 @@ export const test_validate_DynamicComposite = _test_validate( }) ); if ( + "string" === typeof key && RegExp( - /^(between_(.*)_and_[+-]?\d+(?:\.\d+)?(?:[eE][+-]?\d+)?)$/, + /^between_(.*)_and_[+-]?\d+(?:\.\d+)?(?:[eE][+-]?\d+)?$/, ).test(key) ) return ( diff --git a/test/generated/output/validate/test_validate_DynamicJsonValue.ts b/test/generated/output/validate/test_validate_DynamicJsonValue.ts index ce84040232..9db9265f57 100644 --- a/test/generated/output/validate/test_validate_DynamicJsonValue.ts +++ b/test/generated/output/validate/test_validate_DynamicJsonValue.ts @@ -12,7 +12,7 @@ export const test_validate_DynamicJsonValue = _test_validate( Object.keys(input).every((key: any) => { const value = input[key]; if (undefined === value) return true; - if (RegExp(/(.*)/).test(key)) + if (true) return ( null === value || undefined === value || @@ -75,7 +75,7 @@ export const test_validate_DynamicJsonValue = _test_validate( .map((key: any) => { const value = input[key]; if (undefined === value) return true; - if (RegExp(/(.*)/).test(key)) + if (true) return ( null === value || undefined === value || diff --git a/test/generated/output/validate/test_validate_DynamicNever.ts b/test/generated/output/validate/test_validate_DynamicNever.ts index f6be50b5e7..84ebf7a140 100644 --- a/test/generated/output/validate/test_validate_DynamicNever.ts +++ b/test/generated/output/validate/test_validate_DynamicNever.ts @@ -12,8 +12,7 @@ export const test_validate_DynamicNever = _test_validate( Object.keys(input).every((key: any) => { const value = input[key]; if (undefined === value) return true; - if (RegExp(/(.*)/).test(key)) - return null !== value && undefined === value; + if (true) return null !== value && undefined === value; return true; }); return ( @@ -42,7 +41,7 @@ export const test_validate_DynamicNever = _test_validate( .map((key: any) => { const value = input[key]; if (undefined === value) return true; - if (RegExp(/(.*)/).test(key)) + if (true) return ( (null !== value || $report(_exceptionable, { diff --git a/test/generated/output/validate/test_validate_DynamicTag.ts b/test/generated/output/validate/test_validate_DynamicTag.ts new file mode 100644 index 0000000000..8c26bd2234 --- /dev/null +++ b/test/generated/output/validate/test_validate_DynamicTag.ts @@ -0,0 +1,137 @@ +import typia from "../../../../src"; +import { _test_validate } from "../../../internal/_test_validate"; +import { DynamicTag } from "../../../structures/DynamicTag"; + +export const test_validate_DynamicTag = _test_validate( + "DynamicTag", +)(DynamicTag)((input) => + ((input: any): typia.IValidation => { + const errors = [] as any[]; + const __is = (input: any): input is DynamicTag => { + const $io0 = (input: any): boolean => + Object.keys(input).every((key: any) => { + const value = input[key]; + if (undefined === value) return true; + if ( + "number" === typeof Number(key) && + 0 <= Number(key) && + Number(key) < 10 + ) + return "bigint" === typeof value && BigInt(0) <= value; + if ( + "string" === typeof key && + /^(?:[0-9a-f]{8}-[0-9a-f]{4}-[1-5][0-9a-f]{3}-[89ab][0-9a-f]{3}-[0-9a-f]{12}|00000000-0000-0000-0000-000000000000)$/i.test( + key, + ) + ) + return ( + "string" === typeof value && + /^(([^<>()[\]\.,;:\s@\"]+(\.[^<>()[\]\.,;:\s@\"]+)*)|(\".+\"))@(([^<>()[\]\.,;:\s@\"]+\.)+[^<>()[\]\.,;:\s@\"]{2,})$/i.test( + value, + ) + ); + return true; + }); + return ( + "object" === typeof input && + null !== input && + false === Array.isArray(input) && + $io0(input) + ); + }; + if (false === __is(input)) { + const $report = (typia.validate as any).report(errors); + (( + input: any, + _path: string, + _exceptionable: boolean = true, + ): input is DynamicTag => { + const $join = (typia.validate as any).join; + const $vo0 = ( + input: any, + _path: string, + _exceptionable: boolean = true, + ): boolean => + [ + false === _exceptionable || + Object.keys(input) + .map((key: any) => { + const value = input[key]; + if (undefined === value) return true; + if ( + "number" === typeof Number(key) && + 0 <= Number(key) && + Number(key) < 10 + ) + return ( + ("bigint" === typeof value && + (BigInt(0) <= value || + $report(_exceptionable, { + path: + _path + $join(key), + expected: + 'bigint & Type<"uint64">', + value: value, + }))) || + $report(_exceptionable, { + path: _path + $join(key), + expected: + '(bigint & Type<"uint64">)', + value: value, + }) + ); + if ( + "string" === typeof key && + /^(?:[0-9a-f]{8}-[0-9a-f]{4}-[1-5][0-9a-f]{3}-[89ab][0-9a-f]{3}-[0-9a-f]{12}|00000000-0000-0000-0000-000000000000)$/i.test( + key, + ) + ) + return ( + ("string" === typeof value && + (/^(([^<>()[\]\.,;:\s@\"]+(\.[^<>()[\]\.,;:\s@\"]+)*)|(\".+\"))@(([^<>()[\]\.,;:\s@\"]+\.)+[^<>()[\]\.,;:\s@\"]{2,})$/i.test( + value, + ) || + $report(_exceptionable, { + path: + _path + $join(key), + expected: + 'string & Format<"email">', + value: value, + }))) || + $report(_exceptionable, { + path: _path + $join(key), + expected: + '(string & Format<"email">)', + value: value, + }) + ); + return true; + }) + .every((flag: boolean) => flag), + ].every((flag: boolean) => flag); + return ( + ((("object" === typeof input && + null !== input && + false === Array.isArray(input)) || + $report(true, { + path: _path + "", + expected: "DynamicTag", + value: input, + })) && + $vo0(input, _path + "", true)) || + $report(true, { + path: _path + "", + expected: "DynamicTag", + value: input, + }) + ); + })(input, "$input", true); + } + const success = 0 === errors.length; + return { + success, + errors, + data: success ? input : undefined, + } as any; + })(input), +); diff --git a/test/generated/output/validate/test_validate_DynamicTemplate.ts b/test/generated/output/validate/test_validate_DynamicTemplate.ts index c59e55c99c..9bb93ac85a 100644 --- a/test/generated/output/validate/test_validate_DynamicTemplate.ts +++ b/test/generated/output/validate/test_validate_DynamicTemplate.ts @@ -12,21 +12,29 @@ export const test_validate_DynamicTemplate = _test_validate( Object.keys(input).every((key: any) => { const value = input[key]; if (undefined === value) return true; - if (RegExp(/^(prefix_(.*))/).test(key)) + if ( + "string" === typeof key && + RegExp(/^prefix_(.*)/).test(key) + ) return "string" === typeof value; - if (RegExp(/((.*)_postfix)$/).test(key)) + if ( + "string" === typeof key && + RegExp(/(.*)_postfix$/).test(key) + ) return "string" === typeof value; if ( + "string" === typeof key && RegExp( - /^(value_[+-]?\d+(?:\.\d+)?(?:[eE][+-]?\d+)?)$/, + /^value_[+-]?\d+(?:\.\d+)?(?:[eE][+-]?\d+)?$/, ).test(key) ) return ( "number" === typeof value && Number.isFinite(value) ); if ( + "string" === typeof key && RegExp( - /^(between_(.*)_and_[+-]?\d+(?:\.\d+)?(?:[eE][+-]?\d+)?)$/, + /^between_(.*)_and_[+-]?\d+(?:\.\d+)?(?:[eE][+-]?\d+)?$/, ).test(key) ) return "boolean" === typeof value; @@ -58,7 +66,10 @@ export const test_validate_DynamicTemplate = _test_validate( .map((key: any) => { const value = input[key]; if (undefined === value) return true; - if (RegExp(/^(prefix_(.*))/).test(key)) + if ( + "string" === typeof key && + RegExp(/^prefix_(.*)/).test(key) + ) return ( "string" === typeof value || $report(_exceptionable, { @@ -67,7 +78,10 @@ export const test_validate_DynamicTemplate = _test_validate( value: value, }) ); - if (RegExp(/((.*)_postfix)$/).test(key)) + if ( + "string" === typeof key && + RegExp(/(.*)_postfix$/).test(key) + ) return ( "string" === typeof value || $report(_exceptionable, { @@ -77,8 +91,9 @@ export const test_validate_DynamicTemplate = _test_validate( }) ); if ( + "string" === typeof key && RegExp( - /^(value_[+-]?\d+(?:\.\d+)?(?:[eE][+-]?\d+)?)$/, + /^value_[+-]?\d+(?:\.\d+)?(?:[eE][+-]?\d+)?$/, ).test(key) ) return ( @@ -91,8 +106,9 @@ export const test_validate_DynamicTemplate = _test_validate( }) ); if ( + "string" === typeof key && RegExp( - /^(between_(.*)_and_[+-]?\d+(?:\.\d+)?(?:[eE][+-]?\d+)?)$/, + /^between_(.*)_and_[+-]?\d+(?:\.\d+)?(?:[eE][+-]?\d+)?$/, ).test(key) ) return ( diff --git a/test/generated/output/validate/test_validate_DynamicTree.ts b/test/generated/output/validate/test_validate_DynamicTree.ts index f127898492..798e888fb1 100644 --- a/test/generated/output/validate/test_validate_DynamicTree.ts +++ b/test/generated/output/validate/test_validate_DynamicTree.ts @@ -20,7 +20,7 @@ export const test_validate_DynamicTree = _test_validate( Object.keys(input).every((key: any) => { const value = input[key]; if (undefined === value) return true; - if (RegExp(/(.*)/).test(key)) + if (true) return ( "object" === typeof value && null !== value && @@ -87,7 +87,7 @@ export const test_validate_DynamicTree = _test_validate( .map((key: any) => { const value = input[key]; if (undefined === value) return true; - if (RegExp(/(.*)/).test(key)) + if (true) return ( ((("object" === typeof value && null !== value) || diff --git a/test/generated/output/validate/test_validate_DynamicUndefined.ts b/test/generated/output/validate/test_validate_DynamicUndefined.ts index 9d18c586ed..377b1430c2 100644 --- a/test/generated/output/validate/test_validate_DynamicUndefined.ts +++ b/test/generated/output/validate/test_validate_DynamicUndefined.ts @@ -12,8 +12,7 @@ export const test_validate_DynamicUndefined = _test_validate( Object.keys(input).every((key: any) => { const value = input[key]; if (undefined === value) return true; - if (RegExp(/(.*)/).test(key)) - return null !== value && undefined === value; + if (true) return null !== value && undefined === value; return true; }); return ( @@ -42,7 +41,7 @@ export const test_validate_DynamicUndefined = _test_validate( .map((key: any) => { const value = input[key]; if (undefined === value) return true; - if (RegExp(/(.*)/).test(key)) + if (true) return ( (null !== value || $report(_exceptionable, { diff --git a/test/generated/output/validate/test_validate_DynamicUnion.ts b/test/generated/output/validate/test_validate_DynamicUnion.ts index 554bc0ef23..7d9bf1aa73 100644 --- a/test/generated/output/validate/test_validate_DynamicUnion.ts +++ b/test/generated/output/validate/test_validate_DynamicUnion.ts @@ -13,18 +13,24 @@ export const test_validate_DynamicUnion = _test_validate( const value = input[key]; if (undefined === value) return true; if ( - RegExp(/^[+-]?\d+(?:\.\d+)?(?:[eE][+-]?\d+)?$/).test( - key, - ) + "number" === typeof Number(key) && + Number.isFinite(Number(key)) ) return "string" === typeof value; - if (RegExp(/^(prefix_(.*))/).test(key)) + if ( + "string" === typeof key && + RegExp(/^prefix_(.*)/).test(key) + ) return "string" === typeof value; - if (RegExp(/((.*)_postfix)$/).test(key)) + if ( + "string" === typeof key && + RegExp(/(.*)_postfix$/).test(key) + ) return "string" === typeof value; if ( + "string" === typeof key && RegExp( - /^(value_between_[+-]?\d+(?:\.\d+)?(?:[eE][+-]?\d+)?_and_[+-]?\d+(?:\.\d+)?(?:[eE][+-]?\d+)?)$/, + /^value_between_[+-]?\d+(?:\.\d+)?(?:[eE][+-]?\d+)?_and_[+-]?\d+(?:\.\d+)?(?:[eE][+-]?\d+)?$/, ).test(key) ) return ( @@ -59,9 +65,8 @@ export const test_validate_DynamicUnion = _test_validate( const value = input[key]; if (undefined === value) return true; if ( - RegExp( - /^[+-]?\d+(?:\.\d+)?(?:[eE][+-]?\d+)?$/, - ).test(key) + "number" === typeof Number(key) && + Number.isFinite(Number(key)) ) return ( "string" === typeof value || @@ -71,7 +76,10 @@ export const test_validate_DynamicUnion = _test_validate( value: value, }) ); - if (RegExp(/^(prefix_(.*))/).test(key)) + if ( + "string" === typeof key && + RegExp(/^prefix_(.*)/).test(key) + ) return ( "string" === typeof value || $report(_exceptionable, { @@ -80,7 +88,10 @@ export const test_validate_DynamicUnion = _test_validate( value: value, }) ); - if (RegExp(/((.*)_postfix)$/).test(key)) + if ( + "string" === typeof key && + RegExp(/(.*)_postfix$/).test(key) + ) return ( "string" === typeof value || $report(_exceptionable, { @@ -90,8 +101,9 @@ export const test_validate_DynamicUnion = _test_validate( }) ); if ( + "string" === typeof key && RegExp( - /^(value_between_[+-]?\d+(?:\.\d+)?(?:[eE][+-]?\d+)?_and_[+-]?\d+(?:\.\d+)?(?:[eE][+-]?\d+)?)$/, + /^value_between_[+-]?\d+(?:\.\d+)?(?:[eE][+-]?\d+)?_and_[+-]?\d+(?:\.\d+)?(?:[eE][+-]?\d+)?$/, ).test(key) ) return ( diff --git a/test/generated/output/validate/test_validate_ObjectDynamic.ts b/test/generated/output/validate/test_validate_ObjectDynamic.ts index 1598305d50..e9e06fddb1 100644 --- a/test/generated/output/validate/test_validate_ObjectDynamic.ts +++ b/test/generated/output/validate/test_validate_ObjectDynamic.ts @@ -12,7 +12,7 @@ export const test_validate_ObjectDynamic = _test_validate( Object.keys(input).every((key: any) => { const value = input[key]; if (undefined === value) return true; - if (RegExp(/(.*)/).test(key)) + if (true) return ( "string" === typeof value || ("number" === typeof value && @@ -47,7 +47,7 @@ export const test_validate_ObjectDynamic = _test_validate( .map((key: any) => { const value = input[key]; if (undefined === value) return true; - if (RegExp(/(.*)/).test(key)) + if (true) return ( "string" === typeof value || ("number" === typeof value && diff --git a/test/generated/output/validate/test_validate_UltimateUnion.ts b/test/generated/output/validate/test_validate_UltimateUnion.ts index ccf5f79656..73080be4cb 100644 --- a/test/generated/output/validate/test_validate_UltimateUnion.ts +++ b/test/generated/output/validate/test_validate_UltimateUnion.ts @@ -514,7 +514,7 @@ export const test_validate_UltimateUnion = _test_validate( Object.keys(input).every((key: any) => { const value = input[key]; if (undefined === value) return true; - if (RegExp(/(.*)/).test(key)) + if (true) return ( "object" === typeof value && null !== value && @@ -576,7 +576,7 @@ export const test_validate_UltimateUnion = _test_validate( Object.keys(input).every((key: any) => { const value = input[key]; if (undefined === value) return true; - if (RegExp(/(.*)/).test(key)) + if (true) return ( "object" === typeof value && null !== value && @@ -3485,7 +3485,7 @@ export const test_validate_UltimateUnion = _test_validate( .map((key: any) => { const value = input[key]; if (undefined === value) return true; - if (RegExp(/(.*)/).test(key)) + if (true) return ( ((("object" === typeof value && null !== value && @@ -3752,7 +3752,7 @@ export const test_validate_UltimateUnion = _test_validate( .map((key: any) => { const value = input[key]; if (undefined === value) return true; - if (RegExp(/(.*)/).test(key)) + if (true) return ( ((("object" === typeof value && null !== value && diff --git a/test/generated/output/validateEquals/test_validateEquals_DynamicComposite.ts b/test/generated/output/validateEquals/test_validateEquals_DynamicComposite.ts index be1079c06f..084bb760a8 100644 --- a/test/generated/output/validateEquals/test_validateEquals_DynamicComposite.ts +++ b/test/generated/output/validateEquals/test_validateEquals_DynamicComposite.ts @@ -24,20 +24,26 @@ export const test_validateEquals_DynamicComposite = _test_validateEquals( const value = input[key]; if (undefined === value) return true; if ( - RegExp(/^[+-]?\d+(?:\.\d+)?(?:[eE][+-]?\d+)?$/).test( - key, - ) + "number" === typeof Number(key) && + Number.isFinite(Number(key)) ) return ( "number" === typeof value && Number.isFinite(value) ); - if (RegExp(/^(prefix_(.*))/).test(key)) + if ( + "string" === typeof key && + RegExp(/^prefix_(.*)/).test(key) + ) return "string" === typeof value; - if (RegExp(/((.*)_postfix)$/).test(key)) + if ( + "string" === typeof key && + RegExp(/(.*)_postfix$/).test(key) + ) return "string" === typeof value; if ( + "string" === typeof key && RegExp( - /^(value_[+-]?\d+(?:\.\d+)?(?:[eE][+-]?\d+)?)$/, + /^value_[+-]?\d+(?:\.\d+)?(?:[eE][+-]?\d+)?$/, ).test(key) ) return ( @@ -47,8 +53,9 @@ export const test_validateEquals_DynamicComposite = _test_validateEquals( "boolean" === typeof value ); if ( + "string" === typeof key && RegExp( - /^(between_(.*)_and_[+-]?\d+(?:\.\d+)?(?:[eE][+-]?\d+)?)$/, + /^between_(.*)_and_[+-]?\d+(?:\.\d+)?(?:[eE][+-]?\d+)?$/, ).test(key) ) return "boolean" === typeof value; @@ -96,9 +103,8 @@ export const test_validateEquals_DynamicComposite = _test_validateEquals( const value = input[key]; if (undefined === value) return true; if ( - RegExp( - /^[+-]?\d+(?:\.\d+)?(?:[eE][+-]?\d+)?$/, - ).test(key) + "number" === typeof Number(key) && + Number.isFinite(Number(key)) ) return ( ("number" === typeof value && @@ -109,7 +115,10 @@ export const test_validateEquals_DynamicComposite = _test_validateEquals( value: value, }) ); - if (RegExp(/^(prefix_(.*))/).test(key)) + if ( + "string" === typeof key && + RegExp(/^prefix_(.*)/).test(key) + ) return ( "string" === typeof value || $report(_exceptionable, { @@ -118,7 +127,10 @@ export const test_validateEquals_DynamicComposite = _test_validateEquals( value: value, }) ); - if (RegExp(/((.*)_postfix)$/).test(key)) + if ( + "string" === typeof key && + RegExp(/(.*)_postfix$/).test(key) + ) return ( "string" === typeof value || $report(_exceptionable, { @@ -128,8 +140,9 @@ export const test_validateEquals_DynamicComposite = _test_validateEquals( }) ); if ( + "string" === typeof key && RegExp( - /^(value_[+-]?\d+(?:\.\d+)?(?:[eE][+-]?\d+)?)$/, + /^value_[+-]?\d+(?:\.\d+)?(?:[eE][+-]?\d+)?$/, ).test(key) ) return ( @@ -145,8 +158,9 @@ export const test_validateEquals_DynamicComposite = _test_validateEquals( }) ); if ( + "string" === typeof key && RegExp( - /^(between_(.*)_and_[+-]?\d+(?:\.\d+)?(?:[eE][+-]?\d+)?)$/, + /^between_(.*)_and_[+-]?\d+(?:\.\d+)?(?:[eE][+-]?\d+)?$/, ).test(key) ) return ( diff --git a/test/generated/output/validateEquals/test_validateEquals_DynamicTag.ts b/test/generated/output/validateEquals/test_validateEquals_DynamicTag.ts new file mode 100644 index 0000000000..1d41edf6cb --- /dev/null +++ b/test/generated/output/validateEquals/test_validateEquals_DynamicTag.ts @@ -0,0 +1,148 @@ +import typia from "../../../../src"; +import { _test_validateEquals } from "../../../internal/_test_validateEquals"; +import { DynamicTag } from "../../../structures/DynamicTag"; + +export const test_validateEquals_DynamicTag = _test_validateEquals( + "DynamicTag", +)(DynamicTag)((input) => + ((input: any): typia.IValidation => { + const errors = [] as any[]; + const __is = ( + input: any, + _exceptionable: boolean = true, + ): input is DynamicTag => { + const $join = (typia.validateEquals as any).join; + const $io0 = ( + input: any, + _exceptionable: boolean = true, + ): boolean => + Object.keys(input).every((key: any) => { + const value = input[key]; + if (undefined === value) return true; + if ( + "number" === typeof Number(key) && + 0 <= Number(key) && + Number(key) < 10 + ) + return "bigint" === typeof value && BigInt(0) <= value; + if ( + "string" === typeof key && + /^(?:[0-9a-f]{8}-[0-9a-f]{4}-[1-5][0-9a-f]{3}-[89ab][0-9a-f]{3}-[0-9a-f]{12}|00000000-0000-0000-0000-000000000000)$/i.test( + key, + ) + ) + return ( + "string" === typeof value && + /^(([^<>()[\]\.,;:\s@\"]+(\.[^<>()[\]\.,;:\s@\"]+)*)|(\".+\"))@(([^<>()[\]\.,;:\s@\"]+\.)+[^<>()[\]\.,;:\s@\"]{2,})$/i.test( + value, + ) + ); + return false; + }); + return ( + "object" === typeof input && + null !== input && + false === Array.isArray(input) && + $io0(input, true) + ); + }; + if (false === __is(input)) { + const $report = (typia.validateEquals as any).report(errors); + (( + input: any, + _path: string, + _exceptionable: boolean = true, + ): input is DynamicTag => { + const $join = (typia.validateEquals as any).join; + const $vo0 = ( + input: any, + _path: string, + _exceptionable: boolean = true, + ): boolean => + [ + false === _exceptionable || + Object.keys(input) + .map((key: any) => { + const value = input[key]; + if (undefined === value) return true; + if ( + "number" === typeof Number(key) && + 0 <= Number(key) && + Number(key) < 10 + ) + return ( + ("bigint" === typeof value && + (BigInt(0) <= value || + $report(_exceptionable, { + path: + _path + $join(key), + expected: + 'bigint & Type<"uint64">', + value: value, + }))) || + $report(_exceptionable, { + path: _path + $join(key), + expected: + '(bigint & Type<"uint64">)', + value: value, + }) + ); + if ( + "string" === typeof key && + /^(?:[0-9a-f]{8}-[0-9a-f]{4}-[1-5][0-9a-f]{3}-[89ab][0-9a-f]{3}-[0-9a-f]{12}|00000000-0000-0000-0000-000000000000)$/i.test( + key, + ) + ) + return ( + ("string" === typeof value && + (/^(([^<>()[\]\.,;:\s@\"]+(\.[^<>()[\]\.,;:\s@\"]+)*)|(\".+\"))@(([^<>()[\]\.,;:\s@\"]+\.)+[^<>()[\]\.,;:\s@\"]{2,})$/i.test( + value, + ) || + $report(_exceptionable, { + path: + _path + $join(key), + expected: + 'string & Format<"email">', + value: value, + }))) || + $report(_exceptionable, { + path: _path + $join(key), + expected: + '(string & Format<"email">)', + value: value, + }) + ); + return $report(_exceptionable, { + path: _path + $join(key), + expected: "undefined", + value: value, + }); + }) + .every((flag: boolean) => flag), + ].every((flag: boolean) => flag); + return ( + ((("object" === typeof input && + null !== input && + false === Array.isArray(input)) || + $report(true, { + path: _path + "", + expected: "DynamicTag", + value: input, + })) && + $vo0(input, _path + "", true)) || + $report(true, { + path: _path + "", + expected: "DynamicTag", + value: input, + }) + ); + })(input, "$input", true); + } + const success = 0 === errors.length; + return { + success, + errors, + data: success ? input : undefined, + } as any; + })(input), +); diff --git a/test/generated/output/validateEquals/test_validateEquals_DynamicTemplate.ts b/test/generated/output/validateEquals/test_validateEquals_DynamicTemplate.ts index c73d1cb5b7..39aed140b3 100644 --- a/test/generated/output/validateEquals/test_validateEquals_DynamicTemplate.ts +++ b/test/generated/output/validateEquals/test_validateEquals_DynamicTemplate.ts @@ -19,21 +19,29 @@ export const test_validateEquals_DynamicTemplate = _test_validateEquals( Object.keys(input).every((key: any) => { const value = input[key]; if (undefined === value) return true; - if (RegExp(/^(prefix_(.*))/).test(key)) + if ( + "string" === typeof key && + RegExp(/^prefix_(.*)/).test(key) + ) return "string" === typeof value; - if (RegExp(/((.*)_postfix)$/).test(key)) + if ( + "string" === typeof key && + RegExp(/(.*)_postfix$/).test(key) + ) return "string" === typeof value; if ( + "string" === typeof key && RegExp( - /^(value_[+-]?\d+(?:\.\d+)?(?:[eE][+-]?\d+)?)$/, + /^value_[+-]?\d+(?:\.\d+)?(?:[eE][+-]?\d+)?$/, ).test(key) ) return ( "number" === typeof value && Number.isFinite(value) ); if ( + "string" === typeof key && RegExp( - /^(between_(.*)_and_[+-]?\d+(?:\.\d+)?(?:[eE][+-]?\d+)?)$/, + /^between_(.*)_and_[+-]?\d+(?:\.\d+)?(?:[eE][+-]?\d+)?$/, ).test(key) ) return "boolean" === typeof value; @@ -65,7 +73,10 @@ export const test_validateEquals_DynamicTemplate = _test_validateEquals( .map((key: any) => { const value = input[key]; if (undefined === value) return true; - if (RegExp(/^(prefix_(.*))/).test(key)) + if ( + "string" === typeof key && + RegExp(/^prefix_(.*)/).test(key) + ) return ( "string" === typeof value || $report(_exceptionable, { @@ -74,7 +85,10 @@ export const test_validateEquals_DynamicTemplate = _test_validateEquals( value: value, }) ); - if (RegExp(/((.*)_postfix)$/).test(key)) + if ( + "string" === typeof key && + RegExp(/(.*)_postfix$/).test(key) + ) return ( "string" === typeof value || $report(_exceptionable, { @@ -84,8 +98,9 @@ export const test_validateEquals_DynamicTemplate = _test_validateEquals( }) ); if ( + "string" === typeof key && RegExp( - /^(value_[+-]?\d+(?:\.\d+)?(?:[eE][+-]?\d+)?)$/, + /^value_[+-]?\d+(?:\.\d+)?(?:[eE][+-]?\d+)?$/, ).test(key) ) return ( @@ -98,8 +113,9 @@ export const test_validateEquals_DynamicTemplate = _test_validateEquals( }) ); if ( + "string" === typeof key && RegExp( - /^(between_(.*)_and_[+-]?\d+(?:\.\d+)?(?:[eE][+-]?\d+)?)$/, + /^between_(.*)_and_[+-]?\d+(?:\.\d+)?(?:[eE][+-]?\d+)?$/, ).test(key) ) return ( diff --git a/test/generated/output/validateEquals/test_validateEquals_DynamicUnion.ts b/test/generated/output/validateEquals/test_validateEquals_DynamicUnion.ts index 36f770ad0a..9d3e022ad8 100644 --- a/test/generated/output/validateEquals/test_validateEquals_DynamicUnion.ts +++ b/test/generated/output/validateEquals/test_validateEquals_DynamicUnion.ts @@ -20,18 +20,24 @@ export const test_validateEquals_DynamicUnion = _test_validateEquals( const value = input[key]; if (undefined === value) return true; if ( - RegExp(/^[+-]?\d+(?:\.\d+)?(?:[eE][+-]?\d+)?$/).test( - key, - ) + "number" === typeof Number(key) && + Number.isFinite(Number(key)) ) return "string" === typeof value; - if (RegExp(/^(prefix_(.*))/).test(key)) + if ( + "string" === typeof key && + RegExp(/^prefix_(.*)/).test(key) + ) return "string" === typeof value; - if (RegExp(/((.*)_postfix)$/).test(key)) + if ( + "string" === typeof key && + RegExp(/(.*)_postfix$/).test(key) + ) return "string" === typeof value; if ( + "string" === typeof key && RegExp( - /^(value_between_[+-]?\d+(?:\.\d+)?(?:[eE][+-]?\d+)?_and_[+-]?\d+(?:\.\d+)?(?:[eE][+-]?\d+)?)$/, + /^value_between_[+-]?\d+(?:\.\d+)?(?:[eE][+-]?\d+)?_and_[+-]?\d+(?:\.\d+)?(?:[eE][+-]?\d+)?$/, ).test(key) ) return ( @@ -66,9 +72,8 @@ export const test_validateEquals_DynamicUnion = _test_validateEquals( const value = input[key]; if (undefined === value) return true; if ( - RegExp( - /^[+-]?\d+(?:\.\d+)?(?:[eE][+-]?\d+)?$/, - ).test(key) + "number" === typeof Number(key) && + Number.isFinite(Number(key)) ) return ( "string" === typeof value || @@ -78,7 +83,10 @@ export const test_validateEquals_DynamicUnion = _test_validateEquals( value: value, }) ); - if (RegExp(/^(prefix_(.*))/).test(key)) + if ( + "string" === typeof key && + RegExp(/^prefix_(.*)/).test(key) + ) return ( "string" === typeof value || $report(_exceptionable, { @@ -87,7 +95,10 @@ export const test_validateEquals_DynamicUnion = _test_validateEquals( value: value, }) ); - if (RegExp(/((.*)_postfix)$/).test(key)) + if ( + "string" === typeof key && + RegExp(/(.*)_postfix$/).test(key) + ) return ( "string" === typeof value || $report(_exceptionable, { @@ -97,8 +108,9 @@ export const test_validateEquals_DynamicUnion = _test_validateEquals( }) ); if ( + "string" === typeof key && RegExp( - /^(value_between_[+-]?\d+(?:\.\d+)?(?:[eE][+-]?\d+)?_and_[+-]?\d+(?:\.\d+)?(?:[eE][+-]?\d+)?)$/, + /^value_between_[+-]?\d+(?:\.\d+)?(?:[eE][+-]?\d+)?_and_[+-]?\d+(?:\.\d+)?(?:[eE][+-]?\d+)?$/, ).test(key) ) return ( diff --git a/test/issues/853.js b/test/issues/853.js new file mode 100644 index 0000000000..a9e2fb531e --- /dev/null +++ b/test/issues/853.js @@ -0,0 +1,32 @@ +(input) => { + const $io0 = (input) => + Object.keys(input).every((key) => { + const value = input[key]; + if (undefined === value) return true; + if ( + "number" === typeof Number(key) && + 0 <= Number(key) && + Number(key) < 10 + ) + return "bigint" === typeof value && BigInt(0) <= value; + if ( + "string" === typeof key && + /^(?:[0-9a-f]{8}-[0-9a-f]{4}-[1-5][0-9a-f]{3}-[89ab][0-9a-f]{3}-[0-9a-f]{12}|00000000-0000-0000-0000-000000000000)$/i.test( + key, + ) + ) + return ( + "string" === typeof value && + /^(([^<>()[\]\.,;:\s@\"]+(\.[^<>()[\]\.,;:\s@\"]+)*)|(\".+\"))@(([^<>()[\]\.,;:\s@\"]+\.)+[^<>()[\]\.,;:\s@\"]{2,})$/i.test( + value, + ) + ); + return true; + }); + return ( + "object" === typeof input && + null !== input && + false === Array.isArray(input) && + $io0(input) + ); +}; diff --git a/test/issues/853.ts b/test/issues/853.ts new file mode 100644 index 0000000000..6fb3b7a263 --- /dev/null +++ b/test/issues/853.ts @@ -0,0 +1,14 @@ +import fs from "fs"; +import typia, { tags } from "typia"; + +export interface DynamicTag { + [key: number & tags.Minimum<0> & tags.ExclusiveMaximum<10>]: bigint & + tags.Type<"uint64">; + [key: string & tags.Format<"uuid">]: string & tags.Format<"email">; +} + +fs.writeFileSync( + __dirname + "/853.js", + typia.createIs().toString(), + "utf8", +); diff --git a/test/structures/DynamicTag.ts b/test/structures/DynamicTag.ts new file mode 100644 index 0000000000..6a488316a8 --- /dev/null +++ b/test/structures/DynamicTag.ts @@ -0,0 +1,41 @@ +import { ArrayUtil } from "typia/lib/utils/ArrayUtil"; + +import { tags } from "../../src"; +import { Spoiler } from "../helpers/Spoiler"; +import { TestRandomGenerator } from "../helpers/TestRandomGenerator"; + +export interface DynamicTag { + [key: number & tags.Minimum<0> & tags.ExclusiveMaximum<10>]: bigint & + tags.Type<"uint64">; + [key: string & tags.Format<"uuid">]: string & tags.Format<"email">; +} +export namespace DynamicTag { + export const BINARABLE = false; + export const JSONABLE = false; + export const PRIMITIVE = false; + + export function generate(): DynamicTag { + const dict: DynamicTag = {}; + ArrayUtil.repeat(10, (i) => { + dict[i] = TestRandomGenerator.bigint(0n, 1_000_000n); + dict[TestRandomGenerator.uuid()] = TestRandomGenerator.email(); + }); + return dict; + } + + export const SPOILERS: Spoiler[] = [ + (input) => { + input[0] = false as any; + return [`$input["0"]`]; + }, + (input) => { + input[9] = -1n; + return [`$input["9"]`]; + }, + (input) => { + const uuid: string = TestRandomGenerator.uuid(); + input[uuid] = "not-email-address"; + return [`$input["${uuid}"]`]; + }, + ]; +} diff --git a/website/package-lock.json b/website/package-lock.json index 250f5413ec..537ba92579 100644 --- a/website/package-lock.json +++ b/website/package-lock.json @@ -31,7 +31,7 @@ "prettier": "^2.8.8", "rimraf": "^5.0.0", "ts-node": "^10.9.1", - "typia": "^5.2.3" + "typia": "^5.2.5" } }, "node_modules/@babel/code-frame": { @@ -5830,9 +5830,9 @@ } }, "node_modules/typia": { - "version": "5.2.3", - "resolved": "https://registry.npmjs.org/typia/-/typia-5.2.3.tgz", - "integrity": "sha512-pGO2jFbqYfbDjt9PjGrQrSFKldBb/YBY4ABdMV5uD0I7BfHp/TmypHW/B5CM/+gS2uap7jXgQP1z3N+idCPDNg==", + "version": "5.2.5", + "resolved": "https://registry.npmjs.org/typia/-/typia-5.2.5.tgz", + "integrity": "sha512-0mRh+eI0dizQOF9+J/RKHVklNlEBoAoUhnOjyIWugMApO3i/F9weaaIifXQZU9dY/U4v+74h6W7ZWCIrEVqt8A==", "dev": true, "dependencies": { "commander": "^10.0.0", @@ -5844,7 +5844,7 @@ "typia": "lib/executable/typia.js" }, "peerDependencies": { - "typescript": ">= 4.8.0" + "typescript": ">=4.8.0 <5.3.0" } }, "node_modules/typia/node_modules/commander": { diff --git a/website/package.json b/website/package.json index 135581bce7..0055ebeae0 100644 --- a/website/package.json +++ b/website/package.json @@ -41,6 +41,6 @@ "prettier": "^2.8.8", "rimraf": "^5.0.0", "ts-node": "^10.9.1", - "typia": "^5.2.4" + "typia": "^5.2.5" } } diff --git a/website/public/sitemap-0.xml b/website/public/sitemap-0.xml index 2e6f7ae825..cd3bb17159 100644 --- a/website/public/sitemap-0.xml +++ b/website/public/sitemap-0.xml @@ -1,23 +1,23 @@ -https://typia.io/2023-10-22T03:15:48.192Zdaily0.7 -https://typia.io/docs/2023-10-22T03:15:48.192Zdaily0.7 -https://typia.io/docs/json/parse/2023-10-22T03:15:48.192Zdaily0.7 -https://typia.io/docs/json/schema/2023-10-22T03:15:48.192Zdaily0.7 -https://typia.io/docs/json/stringify/2023-10-22T03:15:48.192Zdaily0.7 -https://typia.io/docs/misc/2023-10-22T03:15:48.192Zdaily0.7 -https://typia.io/docs/protobuf/decode/2023-10-22T03:15:48.192Zdaily0.7 -https://typia.io/docs/protobuf/encode/2023-10-22T03:15:48.192Zdaily0.7 -https://typia.io/docs/protobuf/message/2023-10-22T03:15:48.192Zdaily0.7 -https://typia.io/docs/pure/2023-10-22T03:15:48.192Zdaily0.7 -https://typia.io/docs/random/2023-10-22T03:15:48.192Zdaily0.7 -https://typia.io/docs/setup/2023-10-22T03:15:48.192Zdaily0.7 -https://typia.io/docs/utilization/nestjs/2023-10-22T03:15:48.192Zdaily0.7 -https://typia.io/docs/utilization/prisma/2023-10-22T03:15:48.192Zdaily0.7 -https://typia.io/docs/utilization/trpc/2023-10-22T03:15:48.192Zdaily0.7 -https://typia.io/docs/validators/assert/2023-10-22T03:15:48.192Zdaily0.7 -https://typia.io/docs/validators/is/2023-10-22T03:15:48.192Zdaily0.7 -https://typia.io/docs/validators/tags/2023-10-22T03:15:48.192Zdaily0.7 -https://typia.io/docs/validators/validate/2023-10-22T03:15:48.192Zdaily0.7 -https://typia.io/playground/2023-10-22T03:15:48.192Zdaily0.7 +https://typia.io/2023-11-05T14:11:49.203Zdaily0.7 +https://typia.io/docs/2023-11-05T14:11:49.204Zdaily0.7 +https://typia.io/docs/json/parse/2023-11-05T14:11:49.204Zdaily0.7 +https://typia.io/docs/json/schema/2023-11-05T14:11:49.204Zdaily0.7 +https://typia.io/docs/json/stringify/2023-11-05T14:11:49.204Zdaily0.7 +https://typia.io/docs/misc/2023-11-05T14:11:49.204Zdaily0.7 +https://typia.io/docs/protobuf/decode/2023-11-05T14:11:49.204Zdaily0.7 +https://typia.io/docs/protobuf/encode/2023-11-05T14:11:49.204Zdaily0.7 +https://typia.io/docs/protobuf/message/2023-11-05T14:11:49.204Zdaily0.7 +https://typia.io/docs/pure/2023-11-05T14:11:49.204Zdaily0.7 +https://typia.io/docs/random/2023-11-05T14:11:49.204Zdaily0.7 +https://typia.io/docs/setup/2023-11-05T14:11:49.204Zdaily0.7 +https://typia.io/docs/utilization/nestjs/2023-11-05T14:11:49.204Zdaily0.7 +https://typia.io/docs/utilization/prisma/2023-11-05T14:11:49.204Zdaily0.7 +https://typia.io/docs/utilization/trpc/2023-11-05T14:11:49.204Zdaily0.7 +https://typia.io/docs/validators/assert/2023-11-05T14:11:49.204Zdaily0.7 +https://typia.io/docs/validators/is/2023-11-05T14:11:49.204Zdaily0.7 +https://typia.io/docs/validators/tags/2023-11-05T14:11:49.204Zdaily0.7 +https://typia.io/docs/validators/validate/2023-11-05T14:11:49.204Zdaily0.7 +https://typia.io/playground/2023-11-05T14:11:49.204Zdaily0.7 \ No newline at end of file