Skip to content

Commit

Permalink
Optimize functional namespaced functions.
Browse files Browse the repository at this point in the history
  • Loading branch information
samchon committed Aug 3, 2024
1 parent eb6db91 commit 4d3edfa
Show file tree
Hide file tree
Showing 45 changed files with 1,248 additions and 1,111 deletions.
2 changes: 1 addition & 1 deletion benchmark/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -72,6 +72,6 @@
"suppress-warnings": "^1.0.2",
"tstl": "^3.0.0",
"uuid": "^9.0.1",
"typia": "../typia-6.7.0-dev.20240803-2.tgz"
"typia": "../typia-6.7.0-dev.20240803-5.tgz"
}
}
2 changes: 1 addition & 1 deletion debug/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@
},
"dependencies": {
"tstl": "^3.0.0",
"typia": "../typia-6.7.0-dev.20240802-2.tgz",
"typia": "../typia-6.7.0-dev.20240803-4.tgz",
"uuid": "^10.0.0"
}
}
15 changes: 0 additions & 15 deletions debug/src/decode.ts

This file was deleted.

25 changes: 0 additions & 25 deletions debug/src/form.ts

This file was deleted.

39 changes: 39 additions & 0 deletions debug/src/functional.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
import typia from "typia";

const sum = (x: number, y: number): number => x + y;

//----
// ASSERT
//----
// ASSERT-PARAMETERS
typia.functional.assertParameters(sum);

// ASSERT-RETURN
typia.functional.assertReturn(sum);

// ASSERT-FUNCTION
typia.functional.assertFunction(sum);

//----
// IS
//----
// IS-PARAMETERS
typia.functional.isParameters(sum);

// IS-RETURN
typia.functional.isReturn(sum);

// IS-FUNCTION
typia.functional.isFunction(sum);

//----
// VALIDATE
//----
// VALIDATE-PARAMETERS
typia.functional.validateParameters(sum);

// VALIDATE-RETURN
typia.functional.validateReturn(sum);

// VALIDATE-FUNCTION
typia.functional.validateFunction(sum);
43 changes: 0 additions & 43 deletions debug/src/internal/DynamicTag.ts

This file was deleted.

64 changes: 0 additions & 64 deletions debug/src/internal/ObjectHttpFormData.ts

This file was deleted.

3 changes: 0 additions & 3 deletions debug/src/internal/Spoiler.ts

This file was deleted.

18 changes: 0 additions & 18 deletions debug/src/internal/TestRandomGenerator.ts

This file was deleted.

15 changes: 0 additions & 15 deletions debug/src/internal/create_form_data.ts

This file was deleted.

5 changes: 0 additions & 5 deletions debug/src/meta.ts

This file was deleted.

9 changes: 0 additions & 9 deletions debug/src/prune.ts

This file was deleted.

2 changes: 1 addition & 1 deletion errors/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,6 @@
"typescript": "^5.3.2"
},
"dependencies": {
"typia": "../typia-6.7.0-dev.20240803-2.tgz"
"typia": "../typia-6.7.0-dev.20240803-5.tgz"
}
}
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "typia",
"version": "6.7.0-dev.20240803-2",
"version": "6.7.0-dev.20240803-5",
"description": "Superfast runtime validators with only one line",
"main": "lib/index.js",
"typings": "lib/index.d.ts",
Expand Down
4 changes: 2 additions & 2 deletions packages/typescript-json/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "typescript-json",
"version": "6.7.0-dev.20240803-2",
"version": "6.7.0-dev.20240803-5",
"description": "Superfast runtime validators with only one line",
"main": "lib/index.js",
"typings": "lib/index.d.ts",
Expand Down Expand Up @@ -63,7 +63,7 @@
},
"homepage": "https://typia.io",
"dependencies": {
"typia": "6.7.0-dev.20240803-2"
"typia": "6.7.0-dev.20240803-5"
},
"peerDependencies": {
"typescript": ">=4.8.0 <5.6.0"
Expand Down
1 change: 1 addition & 0 deletions src/programmers/AssertProgrammer.ts
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@ export namespace AssertProgrammer {
type: ts.Type;
name: string | undefined;
init: ts.Expression | undefined;
inline?: boolean;
}): FeatureProgrammer.IDecomposed => {
const is: FeatureProgrammer.IDecomposed = IsProgrammer.decompose(props);
const composed: FeatureProgrammer.IComposed = CheckerProgrammer.compose({
Expand Down
41 changes: 0 additions & 41 deletions src/programmers/IsProgrammer.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,10 +3,8 @@ import ts from "typescript";
import { ExpressionFactory } from "../factories/ExpressionFactory";
import { IdentifierFactory } from "../factories/IdentifierFactory";
import { MetadataCollection } from "../factories/MetadataCollection";
// import { TypeFactory } from "../factories/TypeFactory";
import { ValueFactory } from "../factories/ValueFactory";

// import { MetadataObject } from "../schemas/metadata/MetadataObject";
import { IProject } from "../transformers/IProject";

import { CheckerProgrammer } from "./CheckerProgrammer";
Expand All @@ -16,8 +14,6 @@ import { IExpressionEntry } from "./helpers/IExpressionEntry";
import { OptionPredicator } from "./helpers/OptionPredicator";
import { check_object } from "./internal/check_object";

// import { feature_object_entries } from "./internal/feature_object_entries";

export namespace IsProgrammer {
export const configure =
(options?: Partial<CONFIG.IOptions>) =>
Expand Down Expand Up @@ -122,43 +118,6 @@ export namespace IsProgrammer {
})(props.project)(props.importer),
trace: props.equals,
};
// config.decoder = () => (input, target, explore) => {
// if (
// target.size() === 1 &&
// target.objects.length === 1 &&
// target.isRequired() === true &&
// target.nullable === false
// ) {
// // ONLY WHEN OBJECT WITH SOME ATOMIC PROPERTIES
// const obj: MetadataObject = target.objects[0]!;
// if (
// obj.isPlain(explore.from === "top" ? 0 : 1) &&
// (props.equals === false ||
// OptionPredicator.undefined(props.project.options) === false)
// )
// return ts.factory.createLogicalAnd(
// ExpressionFactory.isObject({
// checkNull: true,
// checkArray: false,
// })(input),
// config.joiner.object(
// ts.factory.createAsExpression(input, TypeFactory.keyword("any")),
// feature_object_entries(config as any)(props.importer)(obj)(
// ts.factory.createAsExpression(
// input,
// TypeFactory.keyword("any"),
// ),
// "top",
// ),
// ),
// );
// }
// return CheckerProgrammer.decode(props.project)(config)(props.importer)(
// input,
// target,
// explore,
// );
// };

// COMPOSITION
const composed: FeatureProgrammer.IComposed = CheckerProgrammer.compose({
Expand Down
Loading

0 comments on commit 4d3edfa

Please sign in to comment.