aboutsummaryrefslogtreecommitdiffstats
path: root/old-ui/app/util.js
diff options
context:
space:
mode:
authorkumavis <kumavis@users.noreply.github.com>2018-11-02 09:29:45 +0800
committerGitHub <noreply@github.com>2018-11-02 09:29:45 +0800
commit337a4e1b4ea7a560d773bc262b2adffd1617a39b (patch)
treef3c2f9b33642ef9be901645645734129686e6c6e /old-ui/app/util.js
parentc2f97717c0fbf9a64cf527891f7a1f35049fb023 (diff)
parentde231c7a6191ca869308b6d27ca9cd4b020e59aa (diff)
downloadtangerine-wallet-browser-337a4e1b4ea7a560d773bc262b2adffd1617a39b.tar.gz
tangerine-wallet-browser-337a4e1b4ea7a560d773bc262b2adffd1617a39b.tar.zst
tangerine-wallet-browser-337a4e1b4ea7a560d773bc262b2adffd1617a39b.zip
Merge pull request #5649 from MetaMask/develop
Version 4.17.0
Diffstat (limited to 'old-ui/app/util.js')
-rw-r--r--old-ui/app/util.js8
1 files changed, 4 insertions, 4 deletions
diff --git a/old-ui/app/util.js b/old-ui/app/util.js
index 962832ce7..40e79b88c 100644
--- a/old-ui/app/util.js
+++ b/old-ui/app/util.js
@@ -102,7 +102,7 @@ function parseBalance (balance) {
// Takes wei hex, returns an object with three properties.
// Its "formatted" property is what we generally use to render values.
-function formatBalance (balance, decimalsToKeep, needsParse = true) {
+function formatBalance (balance, decimalsToKeep, needsParse = true, ticker = 'ETH') {
var parsed = needsParse ? parseBalance(balance) : balance.split('.')
var beforeDecimal = parsed[0]
var afterDecimal = parsed[1]
@@ -112,14 +112,14 @@ function formatBalance (balance, decimalsToKeep, needsParse = true) {
if (afterDecimal !== '0') {
var sigFigs = afterDecimal.match(/^0*(.{2})/) // default: grabs 2 most significant digits
if (sigFigs) { afterDecimal = sigFigs[0] }
- formatted = '0.' + afterDecimal + ' ETH'
+ formatted = '0.' + afterDecimal + ` ${ticker}`
}
} else {
- formatted = beforeDecimal + '.' + afterDecimal.slice(0, 3) + ' ETH'
+ formatted = beforeDecimal + '.' + afterDecimal.slice(0, 3) + ` ${ticker}`
}
} else {
afterDecimal += Array(decimalsToKeep).join('0')
- formatted = beforeDecimal + '.' + afterDecimal.slice(0, decimalsToKeep) + ' ETH'
+ formatted = beforeDecimal + '.' + afterDecimal.slice(0, decimalsToKeep) + ` ${ticker}`
}
return formatted
}