1
0
mirror of https://github.com/kremalicious/metamask-extension.git synced 2024-11-26 12:29:06 +01:00

Make zero balance display 0. Fixes #449

This commit is contained in:
Aust 2016-07-18 09:54:06 -06:00 committed by GitHub
parent 667483ac20
commit 061633bf67

View File

@ -123,7 +123,11 @@ function generateBalanceObject (formattedBalance, decimalsToKeep = 1) {
var shortBalance = shortenBalance(balance, decimalsToKeep)
if (beforeDecimal === '0' && afterDecimal.substr(0, 5) === '00000') {
balance = '<1.0e-5'
if (afterDecimal == 0) {
balance = '0'
} else {
balance = '<1.0e-5'
}
} else if (beforeDecimal !== '0') {
balance = `${beforeDecimal}.${afterDecimal.slice(0, decimalsToKeep)}`
}