From e7346b621b58469eb9e708b4320972397304acab Mon Sep 17 00:00:00 2001 From: Omar Basem Date: Wed, 3 Jan 2024 15:25:45 +0400 Subject: [PATCH] lint --- .../contexts/wallet/common/utils.cljs | 24 +++++++++---------- 1 file changed, 12 insertions(+), 12 deletions(-) diff --git a/src/status_im/contexts/wallet/common/utils.cljs b/src/status_im/contexts/wallet/common/utils.cljs index 66fe41847c0d..60119b80a158 100644 --- a/src/status_im/contexts/wallet/common/utils.cljs +++ b/src/status_im/contexts/wallet/common/utils.cljs @@ -45,25 +45,25 @@ (defn calc-max-crypto-decimals [value] - (let [str-representation (str value) - decimal-part (second (clojure.string/split str-representation #"\.")) - exponent (extract-exponent str-representation) - zeroes-count (count (take-while #(= \0 %) decimal-part)) - max-decimals (or exponent zeroes-count)] - (let [first-non-zero-digit (first (filter #(not (= \0 %)) decimal-part))] - (if (= \1 first-non-zero-digit) - (inc max-decimals) - max-decimals)))) + (let [str-representation (str value) + decimal-part (second (clojure.string/split str-representation #"\.")) + exponent (extract-exponent str-representation) + zeroes-count (count (take-while #(= \0 %) decimal-part)) + max-decimals (or exponent zeroes-count) + first-non-zero-digit (first (filter #(not (= \0 %)) decimal-part))] + (if (= \1 first-non-zero-digit) + (inc max-decimals) + max-decimals))) (defn get-standard-crypto-format "For full details: https://github.com/status-im/status-mobile/issues/18225" [{:keys [market-values-per-currency]} token-units] (let [price (get-in market-values-per-currency [:usd :price]) one-cent-value (if (pos? price) (/ 0.01 price) 0) - count (calc-max-crypto-decimals one-cent-value)] + decimals-count (calc-max-crypto-decimals one-cent-value)] (if (< token-units one-cent-value) - (str "<" (.toFixed one-cent-value count)) - (.toFixed token-units count)))) + (str "<" (.toFixed one-cent-value decimals-count)) + (.toFixed token-units decimals-count)))) (defn total-token-units-in-all-chains [{:keys [balances-per-chain decimals] :as _token}]