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

Function parseJsonSafe

packages/core/sdk/src/insufficient-scope.ts:68–76  ·  view source on GitHub ↗
(text: string)

Source from the content-addressed store, hash-verified

66};
67
68const parseJsonSafe = (text: string): unknown => {
69 // oxlint-disable-next-line executor/no-try-catch-or-throw -- boundary: classifying an untrusted upstream error body; a parse failure just means "not a JSON body", never an error path
70 try {
71 // oxlint-disable-next-line executor/no-json-parse -- boundary: same untrusted-body classification; the parsed value is only structurally inspected, never decoded into domain types
72 return JSON.parse(text) as unknown;
73 } catch {
74 return undefined;
75 }
76};
77
78const detectFromBody = (body: unknown): boolean => {
79 if (typeof body === "string") {

Callers 2

detectFromBodyFunction · 0.70

Calls

no outgoing calls

Tested by

no test coverage detected