From abb37627a819dc884eaed6f1c78a919d5f308345 Mon Sep 17 00:00:00 2001 From: sairaj mote Date: Thu, 13 Apr 2023 00:23:25 +0530 Subject: [PATCH] Bug fix --- docs/index.html | 20 +++++++++++++------- 1 file changed, 13 insertions(+), 7 deletions(-) diff --git a/docs/index.html b/docs/index.html index 5966552..1b70631 100644 --- a/docs/index.html +++ b/docs/index.html @@ -5,7 +5,7 @@ - RanchiMall exchange + RanchiMall Exchange @@ -1821,10 +1821,15 @@ // remove digitals after specified decimal places without rounding function toFixed(num, fixed = 8) { - var re = new RegExp('^-?\\d+(?:\.\\d{0,' + (fixed || -1) + '})?'); - return parseFloat(num.toString().match(re)[0]); + const re = new RegExp(`^-?\\d+(?:\\.\\d{0,${fixed}})?`); + const match = num.toString().match(re); + if (!match) { + return NaN; + } + return parseFloat(match[0]); } + function getSuggestedPrice(asset = pagesData.params.asset || 'FLO') { return toFixed(parseFloat(floGlobals.exchangeRates[asset]) * deviation[tradeType]) } @@ -2729,10 +2734,10 @@ getRef('market_asset_rates').append(createElement('li', { className: 'listed-asset grid align-center', innerHTML: ` -
${getIcon(asset)}
-

${asset}

- ${formatAmount(rate)} - ` +
${getIcon(asset)}
+

${asset}

+ ${formatAmount(rate)} + ` })) }) resolve(); @@ -2766,6 +2771,7 @@ showSuggestedPrice() }).catch(error => { notify(error.message, 'error'); + reject(error) }) }).catch(error => console.error(error)) }