mirror of
https://github.com/kremalicious/metamask-extension.git
synced 2024-12-23 09:52:26 +01:00
Handle to small of balances with "<0.00001"
This commit is contained in:
parent
525abb85d4
commit
8834548b01
@ -105,7 +105,7 @@ function formatBalance (balance, decimalsToKeep) {
|
||||
if (afterDecimal !== '0') {
|
||||
var sigFigs = afterDecimal.match(/^0*(.{2})/) // default: grabs 2 most significant digits
|
||||
if (sigFigs) { afterDecimal = sigFigs[0] }
|
||||
formattedBalance = `0.${afterDecimal.slice(0, 6)}`
|
||||
formattedBalance = afterDecimal.substr(0, 5) === '00000' ? '<0.00001' : `0.${afterDecimal.slice(0, 6)}`
|
||||
}
|
||||
} else {
|
||||
formattedBalance = `${beforeDecimal}.${afterDecimal.slice(0, 2)}`
|
||||
|
Loading…
Reference in New Issue
Block a user