MCPcopy Create free account
hub / github.com/ScrapeGraphAI/just-scrape / parseJsonArg

Function parseJsonArg

src/lib/parse.ts:3–10  ·  view source on GitHub ↗
(raw: string, field: string, out: Logger)

Source from the content-addressed store, hash-verified

1import type { Logger } from "./log.js";
2
3export function parseJsonArg(raw: string, field: string, out: Logger): unknown {
4 try {
5 return JSON.parse(raw);
6 } catch (e) {
7 const msg = e instanceof Error ? e.message : String(e);
8 out.error(`--${field}: invalid JSON (${msg})`);
9 }
10}
11
12export function parseIntArg(raw: string, field: string, out: Logger): number {
13 const n = Number(raw);

Callers 4

extract.tsFile · 0.85
scrape.tsFile · 0.85
crawl.tsFile · 0.85
search.tsFile · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected