frontend / api/inventory/utils/fieldPickers / pickNumberFromList
Function: pickNumberFromList()
pickNumberFromList(
r,keys):number|undefined
Defined in: api/inventory/utils/fieldPickers.ts:74
Try a list of keys and return the first numeric value found. Useful for handling multiple possible field names from backend.
Parameters
r
Record<string,
unknown>
Record to extract from
keys
string[]
Keys to try in order
Returns
number | undefined
First finite number found, undefined if none match
Example
const qty = pickNumberFromList(obj, ['quantity', 'qty', 'onHand']);