MCPcopy Create free account
hub / github.com/massCodeIO/massCode / normalizeRates

Function normalizeRates

src/main/currencyRates.ts:41–53  ·  view source on GitHub ↗
(rates: Record<string, number>)

Source from the content-addressed store, hash-verified

39}
40
41function 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
55function createPayload(rates: Record<string, number>): CurrencyRatesPayload {
56 return {

Callers 1

createPayloadFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected