8000 Compare feature by snatvb · Pull Request #1511 · samchon/typia · GitHub
[go: up one dir, main page]
More Web Proxy on the site http://driver.im/
Skip to content

Compare feature #1511

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Draft
wants to merge 13 commits into
base: master
Choose a base branch
from
Draft
19 changes: 19 additions & 0 deletions src/compare.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
/**
* Comapre in deep A and B
*/
export function equals<T>(a: T, b: T): boolean;
/**
* @internal
*/
export function equals<T>(_a: T, _b: T): boolean {
halt("equals");
}

/**
* @internal
*/
function halt(name: string): never {
throw new Error(
`Error on typia.compare.${name}(): no transform has been configured. Read and follow https://typia.io/docs/setup please.`,
);
}
10 changes: 10 additions & 0 deletions src/factories/MetadataCollection.ts
Original file line number Diff line number Diff line change
Expand Up @@ -76,6 +76,16 @@ export class MetadataCollection {
return [...this.tuples_.values()];
}

public findObjectType(target: MetadataObjectType) {
// Add weakmap to index it and avoid finding O(n)
for (const [key, object] of this.objects_.entries()) {
if (object === target) {
return key;
}
}
return undefined;
}

private getName(checker: ts.TypeChecker, type: ts.Type): string {
const name: string = (() => {
const str: string = TypeFactory.getFullName({
Expand Down
3 changes: 3 additions & 0 deletions src/factories/internal/metadata/iterate_metadata.ts
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,9 @@ export const iterate_metadata = (props: IMetadataIteratorProps): void => {
});
return;
}
if (props.type.isClass()) {
props.metadata.class = true;
}
// CHECK SPECIAL CASES
if (
(props.explore.aliased !== true && iterate_metadata_alias(props)) ||
Expand Down
1 change: 1 addition & 0 deletions src/module.ts
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@ export * as notations from "./notations";
export * as protobuf from "./protobuf";
export * as reflect from "./reflect";
export * as tags from "./tags";
export * as compare from "./compare";

export * from "./schemas/metadata/IJsDocTagInfo";
export * from "./schemas/json/IJsonApplication";
Expand Down
Loading
Loading
0