MCPcopy Create free account
hub / github.com/colbymchenry/codegraph / safeJsonParse

Function safeJsonParse

src/utils.ts:193–199  ·  view source on GitHub ↗
(value: string, fallback: T)

Source from the content-addressed store, hash-verified

191 * Prevents crashes from corrupted database metadata.
192 */
193export function safeJsonParse<T>(value: string, fallback: T): T {
194 try {
195 return JSON.parse(value);
196 } catch {
197 return fallback;
198 }
199}
200
201/**
202 * Clamp a numeric value to a range.

Callers 9

rowToNodeFunction · 0.90
rowToEdgeFunction · 0.90
rowToFileRecordFunction · 0.90
getUnresolvedByNameMethod · 0.90

Calls

no outgoing calls

Tested by

no test coverage detected