aboutsummaryrefslogtreecommitdiffstats
path: root/ui
diff options
context:
space:
mode:
authorkumavis <aaron@kumavis.me>2016-04-15 12:19:08 +0800
committerkumavis <aaron@kumavis.me>2016-04-15 12:19:08 +0800
commitcef1f2a65f27d594b12afd021dea73fcaf569af5 (patch)
tree0485d30ecf0c96937f568b6cfe9f928d9ed87a7d /ui
parent1e989fb8a48e61a8dfb9cb3d1f82f46925b1239b (diff)
downloadtangerine-wallet-browser-cef1f2a65f27d594b12afd021dea73fcaf569af5.tar
tangerine-wallet-browser-cef1f2a65f27d594b12afd021dea73fcaf569af5.tar.gz
tangerine-wallet-browser-cef1f2a65f27d594b12afd021dea73fcaf569af5.tar.bz2
tangerine-wallet-browser-cef1f2a65f27d594b12afd021dea73fcaf569af5.tar.lz
tangerine-wallet-browser-cef1f2a65f27d594b12afd021dea73fcaf569af5.tar.xz
tangerine-wallet-browser-cef1f2a65f27d594b12afd021dea73fcaf569af5.tar.zst
tangerine-wallet-browser-cef1f2a65f27d594b12afd021dea73fcaf569af5.zip
ui - util - fixes#110 formatBalance
Diffstat (limited to 'ui')
-rw-r--r--ui/app/util.js4
1 files changed, 2 insertions, 2 deletions
diff --git a/ui/app/util.js b/ui/app/util.js
index 74e2c19aa..67b7c8f67 100644
--- a/ui/app/util.js
+++ b/ui/app/util.js
@@ -66,11 +66,11 @@ function weiToEth(bn) {
var decimalsToKeep = 4
function formatBalance(balance) {
- if (!balance) return 'None'
+ if (!balance || balance === '0x0') return 'None'
var wei = numericBalance(balance)
var padded = wei.toString(10)
var len = padded.length
- var nonZeroIndex = padded.match(/[^0]/).index
+ var nonZeroIndex = padded.match(/[^0]/) && padded.match(/[^0]/).index
var beforeDecimal = padded.substr(nonZeroIndex ? nonZeroIndex : 0, len - 18)
var afterDecimal = padded.substr(len - 18, decimalsToKeep)
return `${beforeDecimal}.${afterDecimal} ETH`