MCPcopy
hub / github.com/flightcontrolhq/superjson / deserialize

Method deserialize

src/index.ts:63–81  ·  view source on GitHub ↗
(payload: SuperJSONResult, options?: { inPlace?: boolean })

Source from the content-addressed store, hash-verified

61 }
62
63 deserialize<T = unknown>(payload: SuperJSONResult, options?: { inPlace?: boolean }): T {
64 const { json, meta } = payload;
65
66 let result: T = options?.inPlace ? json : copy(json) as any;
67
68 if (meta?.values) {
69 result = applyValueAnnotations(result, meta.values, meta.v ?? 0, this);
70 }
71
72 if (meta?.referentialEqualities) {
73 result = applyReferentialEqualityAnnotations(
74 result,
75 meta.referentialEqualities,
76 meta.v ?? 0
77 );
78 }
79
80 return result;
81 }
82
83 stringify(object: SuperJSONValue): string {
84 return JSON.stringify(this.serialize(object));

Callers 5

parseMethod · 0.95
benchmark.jsFile · 0.80
index.test.tsFile · 0.80
transformer.tsFile · 0.80

Calls 2

applyValueAnnotationsFunction · 0.85

Tested by

no test coverage detected