frontend / api/inventory/utils/fieldPickers / pickNumberFromList
Function: pickNumberFromList()
pickNumberFromList(
r,keys):undefined|number
Defined in: src/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
undefined | number
First finite number found, undefined if none match
Example
const qty = pickNumberFromList(obj, ['quantity', 'qty', 'onHand']);