refactor: use a more idiomatic conditional set
This commit is contained in:
parent
2fe92c2ebf
commit
ad5293522d
1 changed files with 4 additions and 2 deletions
|
|
@ -9,12 +9,14 @@ const RETRIES = 2
|
|||
const tickerObjects = {}
|
||||
|
||||
function ticker (fiatCode, cryptoCode, tickerName) {
|
||||
const ticker = tickerObjects[tickerName] ?
|
||||
tickerObjects[tickerName] :
|
||||
if (!tickerObjects[tickerName]) {
|
||||
tickerObjects[tickerName] = new ccxt[tickerName]({
|
||||
timeout: 3000,
|
||||
enableRateLimit: false,
|
||||
})
|
||||
}
|
||||
|
||||
const ticker = tickerObjects[tickerName]
|
||||
|
||||
if (verifyFiatSupport(fiatCode, tickerName)) {
|
||||
return getCurrencyRates(ticker, fiatCode, cryptoCode)
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue