MCPcopy Index your code
hub / github.com/ChartGPU/ChartGPU / parsePercent

Function parsePercent

src/interaction/findNearestPoint.ts:44–49  ·  view source on GitHub ↗
(value: string)

Source from the content-addressed store, hash-verified

42const clamp01 = (v: number): number => Math.min(1, Math.max(0, v));
43
44const parsePercent = (value: string): number | null => {
45 const m = value.trim().match(/^(\d+(?:\.\d+)?)%$/);
46 if (!m) return null;
47 const p = Number(m[1]) / 100;
48 return Number.isFinite(p) ? p : null;
49};
50
51const normalizeStackId = (stack: unknown): string => {
52 if (typeof stack !== 'string') return '';

Callers 1

computeBarLayoutPxFunction · 0.70

Calls

no outgoing calls

Tested by

no test coverage detected