MCPcopy Create free account
hub / github.com/UsefulSoftwareCo/executor / parseJson

Function parseJson

apps/local/src/db/v1-v2-migration.ts:331–338  ·  view source on GitHub ↗
(value: unknown)

Source from the content-addressed store, hash-verified

329};
330
331const parseJson = (value: unknown): unknown => {
332 if (value instanceof ArrayBuffer || ArrayBuffer.isView(value)) {
333 return parseJson(decodeBytes(value));
334 }
335 if (typeof value !== "string") return value;
336 if (value.trim() === "") return null;
337 return JSON.parse(value);
338};
339
340const stringOrNull = (value: unknown): string | null => (value == null ? null : String(value));
341

Callers 1

readV1SnapshotFunction · 0.70

Calls 1

decodeBytesFunction · 0.85

Tested by

no test coverage detected