frontend


frontend / api/inventory/normalizers / normalizeInventoryRow

Function: normalizeInventoryRow()

normalizeInventoryRow(raw): null | InventoryRow

Defined in: src/api/inventory/normalizers.ts:38

Normalize raw backend response into typed InventoryRow. Returns null if required fields (id) are missing. Uses defensive field picking with fallback chains for flexibility.

Parameters

raw

unknown

Unknown backend response data

Returns

null | InventoryRow

Normalized InventoryRow or null if validation fails

Enterprise

  • Accepts multiple field name variations from backend
  • Gracefully handles missing optional fields
  • Never throws; returns null for invalid data