MCPcopy Create free account
hub / github.com/cortex-js/compute-engine / resultFromJSON

Method resultFromJSON

src/common/result.ts:102–109  ·  view source on GitHub ↗
(json: string)

Source from the content-addressed store, hash-verified

100 }
101
102 static resultFromJSON<T>(json: string): Result<T> {
103 const obj = JSON.parse(json);
104 if (obj.ok) {
105 return Result.ok(obj.value);
106 } else {
107 return Result.err(obj.error || 'Unknown error');
108 }
109 }
110
111 unwrap(): T {
112 if (this.ok) return this.value as T;

Callers

nothing calls this directly

Calls 3

okMethod · 0.80
errMethod · 0.80
parseMethod · 0.65

Tested by

no test coverage detected