frontend


frontend / api/suppliers/normalizers / toSupplierRow

Function: toSupplierRow()

toSupplierRow(raw): null | SupplierRow

Defined in: src/api/suppliers/supplierNormalizers.ts:33

Normalize a raw API response object into a strongly-typed SupplierRow. Safely handles missing/misnamed fields from backend with intelligent fallbacks.

Parameters

raw

unknown

Raw DTO from API response

Returns

null | SupplierRow

SupplierRow with all fields safely extracted and coerced, or null if invalid

Example

const rows = response.content
  .map(toSupplierRow)
  .filter((r): r is SupplierRow => r !== null);