MCPcopy Create free account
hub / github.com/ChatLab/ChatLab / toNumber

Function toNumber

packages/core/src/chart/index.ts:116–122  ·  view source on GitHub ↗
(value: unknown, field: string)

Source from the content-addressed store, hash-verified

114}
115
116function toNumber(value: unknown, field: string): number {
117 const num = typeof value === 'number' ? value : Number(value)
118 if (!Number.isFinite(num)) {
119 throw new ChartValidationError(`Field "${field}" contains non-numeric value "${String(value)}"`)
120 }
121 return num
122}
123
124function inferFieldType(values: unknown[]): ChartFieldType {
125 const present = values.filter((v) => v !== null && v !== undefined)

Callers 3

aggregateByLabelFunction · 0.85
buildLineDataFunction · 0.85
buildHeatmapDataFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected