MCPcopy Create free account
hub / github.com/Railly/agentfiles / parseJsonOutput

Function parseJsonOutput

src/skillkit.ts:208–214  ·  view source on GitHub ↗
(out: string)

Source from the content-addressed store, hash-verified

206}
207
208function parseJsonOutput(out: string): Record<string, unknown> | unknown[] | null {
209 const jsonStart = out.indexOf("{");
210 const jsonStartArr = out.indexOf("[");
211 const start = jsonStart === -1 ? jsonStartArr : jsonStartArr === -1 ? jsonStart : Math.min(jsonStart, jsonStartArr);
212 if (start === -1) return null;
213 return JSON.parse(out.slice(start)) as Record<string, unknown> | unknown[];
214}
215
216export function runSkillkitJsonAsync(cmd: string): Promise<Record<string, unknown> | unknown[] | null> {
217 const bin = getSkillkitBin();

Callers 2

runSkillkitJsonFunction · 0.85
runSkillkitJsonAsyncFunction · 0.85

Calls 1

sliceMethod · 0.80

Tested by

no test coverage detected