MCPcopy Create free account
hub / github.com/TanStack/ai / firstNumber

Function firstNumber

packages/ai/src/utilities/numbers.ts:8–15  ·  view source on GitHub ↗
(...candidates: Array<unknown>)

Source from the content-addressed store, hash-verified

6 * by the OTel middleware, or the optional numeric fields on `TokenUsage`.
7 */
8export function firstNumber(...candidates: Array<unknown>): number | undefined {
9 for (const candidate of candidates) {
10 if (typeof candidate === 'number' && Number.isFinite(candidate)) {
11 return candidate
12 }
13 }
14 return undefined
15}

Callers 2

usageAttributesFunction · 0.90
onConfigFunction · 0.90

Calls

no outgoing calls

Tested by

no test coverage detected