From b3b4887fdba75c9654283c6eeaab1b5c2812ff7c Mon Sep 17 00:00:00 2001 From: Mikhail Mikheev Date: Tue, 1 Oct 2019 19:25:10 +0400 Subject: [PATCH] formatAmounts wip --- src/logic/tokens/utils/formatAmounts.js | 10 ++++++++++ 1 file changed, 10 insertions(+) create mode 100644 src/logic/tokens/utils/formatAmounts.js diff --git a/src/logic/tokens/utils/formatAmounts.js b/src/logic/tokens/utils/formatAmounts.js new file mode 100644 index 00000000..e3d35935 --- /dev/null +++ b/src/logic/tokens/utils/formatAmounts.js @@ -0,0 +1,10 @@ +// @flow +export const formatAmount = (number: string | number) => { + let numberFloat = parseFloat(number) + + if (numberFloat < 999.999999) { + numberFloat = numberFloat.toFixed(2).toLocaleString() + } + + return numberFloat +}