From ad5293522dc1cb30953a7f239e7316f2dfdf676e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Andr=C3=A9=20S=C3=A1?= Date: Tue, 26 Apr 2022 10:06:36 +0100 Subject: [PATCH] refactor: use a more idiomatic conditional set --- lib/plugins/ticker/ccxt.js | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/lib/plugins/ticker/ccxt.js b/lib/plugins/ticker/ccxt.js index 410b24fa..080b2f18 100644 --- a/lib/plugins/ticker/ccxt.js +++ b/lib/plugins/ticker/ccxt.js @@ -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)