Skip to content

Commit

Permalink
Fix #103
Browse files Browse the repository at this point in the history
  • Loading branch information
fawazahmed0 authored Aug 12, 2024
1 parent 6994537 commit ef5181a
Showing 1 changed file with 1 addition and 5 deletions.
6 changes: 1 addition & 5 deletions currscript.js
Original file line number Diff line number Diff line change
Expand Up @@ -98,18 +98,14 @@ async function getCurrencies() {
let currDataObj = await getCurrData(currLink)
currDataObj = toLowerCaseKeysBaseCurr(currDataObj)

let currDataObj2 = await getCurrData(currLink2)
// we need to convert base usd to eur
currDataObj2 = toLowerCaseKeysBaseCurr(currDataObj2, currDataObj['usd'])

let currDataObj3 = toLowerCaseKeysBaseCurr( (await getCurrData3()) )
// we need to convert base usd to eur
currDataObj3 = 'eur' in currDataObj3 ? toLowerCaseKeysBaseCurr(currDataObj3, 1/currDataObj3['eur']) : {}

let cryptoDataObj = await getCryptoData()
// we also need to convert base usd to eur
cryptoDataObj = toLowerCaseKeysBaseCurr(cryptoDataObj,currDataObj['usd'])
let CurrJSON = {...currDataObj2, ...currDataObj, ...cryptoDataObj, ...currDataObj3, eur: 1 }
let CurrJSON = { ...currDataObj, ...cryptoDataObj, ...currDataObj3, eur: 1 }
currencyCodesToRemove.forEach(e=>delete CurrJSON?.[e.toLowerCase()])
// return sorted object
return sortObjByKeys(CurrJSON)
Expand Down

0 comments on commit ef5181a

Please sign in to comment.