Function
normalizeRates
(rates: Record<string, number>)
Source from the content-addressed store, hash-verified
| 39 | } |
| 40 | |
| 41 | function normalizeRates(rates: Record<string, number>) { |
| 42 | const normalized: Record<string, number> = { USD: 1 } |
| 43 | |
| 44 | Object.entries(rates).forEach(([code, value]) => { |
| 45 | if (typeof value === 'number' && Number.isFinite(value)) { |
| 46 | normalized[code] = value |
| 47 | } |
| 48 | }) |
| 49 | |
| 50 | normalized.USD = 1 |
| 51 | |
| 52 | return normalized |
| 53 | } |
| 54 | |
| 55 | function createPayload(rates: Record<string, number>): CurrencyRatesPayload { |
| 56 | return { |
Tested by
no test coverage detected