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

Function parsePercent

src/interaction/findCandlestick.ts:13–18  ·  view source on GitHub ↗
(value: string)

Source from the content-addressed store, hash-verified

11const clamp01 = (v: number): number => Math.min(1, Math.max(0, v));
12
13const parsePercent = (value: string): number | null => {
14 const m = value.trim().match(/^(\d+(?:\.\d+)?)%$/);
15 if (!m) return null;
16 const p = Number(m[1]) / 100;
17 return Number.isFinite(p) ? p : null;
18};
19
20const isTupleDataPoint = (p: OHLCDataPoint): p is OHLCDataPointTuple => Array.isArray(p);
21

Callers 1

Calls

no outgoing calls

Tested by

no test coverage detected