MCPcopy
hub / github.com/openclaw/clawsweeper / parseGhJson

Function parseGhJson

src/github-json.ts:3–11  ·  view source on GitHub ↗
(text: string, args: readonly string[])

Source from the content-addressed store, hash-verified

1import { summarizeGhArgs } from "./github-retry.js";
2
3export function parseGhJson<T>(text: string, args: readonly string[]): T {
4 try {
5 return JSON.parse(text) as T;
6 } catch (error) {
7 throw new Error(
8 `Failed to parse JSON from ${summarizeGhArgs(args)}: ${formatParseError(error)}`,
9 );
10 }
11}
12
13export function parseGhJsonLines<T>(text: string, args: readonly string[]): T[] {
14 if (!text) return [];

Callers 4

ghJsonFunction · 0.90
ghJsonOnceFunction · 0.90
ghPageWithHeadersFunction · 0.90

Calls 2

summarizeGhArgsFunction · 0.85
formatParseErrorFunction · 0.85

Tested by

no test coverage detected