frontend


frontend / api/suppliers/normalizers / toSupplierRow

Function: toSupplierRow()

toSupplierRow(raw): SupplierRow | null

Defined in: 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

SupplierRow | null

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);