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

Function highlight

src/lib/log.ts:4–10  ·  view source on GitHub ↗
(json: string)

Source from the content-addressed store, hash-verified

2import chalk from "chalk";
3
4function highlight(json: string): string {
5 return json
6 .replace(/("(?:\\.|[^"\\])*")\s*:/g, (_, key) => `${chalk.cyan(key)}:`)
7 .replace(/:\s*("(?:\\.|[^"\\])*")/g, (match, val) => match.replace(val, chalk.green(val)))
8 .replace(/:\s*(\d+(?:\.\d+)?)\b/g, (_, num) => `: ${chalk.yellow(num)}`)
9 .replace(/:\s*(true|false|null)\b/g, (_, lit) => `: ${chalk.magenta(lit)}`);
10}
11
12function elapsed(ms: number): string {
13 if (ms < 1000) return `${ms}ms`;

Callers 1

resultFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected