MCPcopy Create free account
hub / github.com/MathMan05/Fermi / constructor

Method constructor

src/webpage/typeChecker/checkers/object.ts:5–16  ·  view source on GitHub ↗
(obj: {[key: string]: resolveable} | [resolveable] | [resolveable, resolveable])

Source from the content-addressed store, hash-verified

3export class ObjectChecker extends TypeChecker {
4 obj: {[key: string]: TypeChecker} | [TypeChecker, TypeChecker] | [TypeChecker];
5 constructor(obj: {[key: string]: resolveable} | [resolveable] | [resolveable, resolveable]) {
6 super();
7 if (obj instanceof Array) {
8 this.obj = obj.map((_) => TypeChecker.resolve(_)) as
9 | [TypeChecker, TypeChecker]
10 | [TypeChecker];
11 } else {
12 this.obj = Object.fromEntries(
13 Object.entries(obj).map(([key, value]) => [key, TypeChecker.resolve(value)]),
14 );
15 }
16 }
17 check(obj: unknown) {
18 if (!(obj instanceof Object)) throw new Error(`${obj} is not of type object`);
19 if (this.obj instanceof Array) {

Callers

nothing calls this directly

Calls 1

resolveMethod · 0.45

Tested by

no test coverage detected