MCPcopy Create free account
hub / github.com/callstack/agent-device / parseEmbeddedJson

Function parseEmbeddedJson

src/daemon/network-log.ts:304–316  ·  view source on GitHub ↗
(line: string)

Source from the content-addressed store, hash-verified

302}
303
304function parseEmbeddedJson(line: string): Record<string, unknown> | null {
305 const start = line.indexOf('{');
306 if (start < 0) return null;
307 const end = line.lastIndexOf('}');
308 if (end <= start) return null;
309 const candidate = line.slice(start, end + 1);
310 try {
311 const parsed = JSON.parse(candidate);
312 return parsed && typeof parsed === 'object' ? (parsed as Record<string, unknown>) : null;
313 } catch {
314 return null;
315 }
316}
317
318function readJsonString(value: Record<string, unknown> | null, keys: string[]): string | undefined {
319 if (!value) return undefined;

Callers 1

parseNetworkLineFunction · 0.85

Calls 1

parseMethod · 0.45

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…