MCPcopy Create free account
hub / github.com/colbymchenry/codegraph / span

Function span

scripts/agent-eval/compare-arms.mjs:95–102  ·  view source on GitHub ↗

median [min–max] over runs; the range is the point — never quote one run.

(runs, pick, fmt = (x) => String(Math.round(x)))

Source from the content-addressed store, hash-verified

93
94/** median [min–max] over runs; the range is the point — never quote one run. */
95function span(runs, pick, fmt = (x) => String(Math.round(x))) {
96 const xs = runs.map(pick).filter((x) => x !== null && x !== undefined && Number.isFinite(x));
97 if (!xs.length) return '—';
98 const m = fmt(median(xs));
99 if (xs.length === 1) return m;
100 const lo = fmt(Math.min(...xs)); const hi = fmt(Math.max(...xs));
101 return lo === hi ? m : `${m} [${lo}–${hi}]`;
102}
103
104const int = (x) => Math.round(x).toLocaleString('en-US');
105const pct1 = (x) => `${x.toFixed(1)}%`;

Callers 1

formatComparisonFunction · 0.85

Calls 2

fmtFunction · 0.70
medianFunction · 0.70

Tested by

no test coverage detected