aboutsummaryrefslogtreecommitdiffstats
path: root/lib/main.js
diff options
context:
space:
mode:
authorMarek Kotewicz <marek.kotewicz@gmail.com>2015-01-06 20:26:51 +0800
committerMarek Kotewicz <marek.kotewicz@gmail.com>2015-01-06 20:26:51 +0800
commitaf9242f4cc382a61bea9142ddbd0cec2e1edf08a (patch)
treee08dc7265e59f25057631916684b93b32ac80cd6 /lib/main.js
parent1954b878191e08db04188f0934b15ebe8c2c5a84 (diff)
downloadgo-tangerine-af9242f4cc382a61bea9142ddbd0cec2e1edf08a.tar
go-tangerine-af9242f4cc382a61bea9142ddbd0cec2e1edf08a.tar.gz
go-tangerine-af9242f4cc382a61bea9142ddbd0cec2e1edf08a.tar.bz2
go-tangerine-af9242f4cc382a61bea9142ddbd0cec2e1edf08a.tar.lz
go-tangerine-af9242f4cc382a61bea9142ddbd0cec2e1edf08a.tar.xz
go-tangerine-af9242f4cc382a61bea9142ddbd0cec2e1edf08a.tar.zst
go-tangerine-af9242f4cc382a61bea9142ddbd0cec2e1edf08a.zip
fixed gulp build
Diffstat (limited to 'lib/main.js')
-rw-r--r--lib/main.js10
1 files changed, 7 insertions, 3 deletions
diff --git a/lib/main.js b/lib/main.js
index b6601132d..c9bcfe205 100644
--- a/lib/main.js
+++ b/lib/main.js
@@ -272,7 +272,7 @@ var web3 = {
},
toEth: function(str) {
- var val = typeof str === "string" ? str.indexOf('0x') == 0 ? parseInt(str.substr(2), 16) : parseInt(str) : str;
+ var val = typeof str === "string" ? str.indexOf('0x') === 0 ? parseInt(str.substr(2), 16) : parseInt(str) : str;
var unit = 0;
var units = [ 'wei', 'Kwei', 'Mwei', 'Gwei', 'szabo', 'finney', 'ether', 'grand', 'Mether', 'Gether', 'Tether', 'Pether', 'Eether', 'Zether', 'Yether', 'Nether', 'Dether', 'Vether', 'Uether' ];
while (val > 3000 && unit < units.length - 1)
@@ -281,10 +281,14 @@ var web3 = {
unit++;
}
var s = val.toString().length < val.toFixed(2).length ? val.toString() : val.toFixed(2);
+ var replaceFunction = function($0, $1, $2) {
+ return $1 + ',' + $2;
+ };
+
while (true) {
var o = s;
- s = s.replace(/(\d)(\d\d\d[\.\,])/, function($0, $1, $2) { return $1 + ',' + $2; });
- if (o == s)
+ s = s.replace(/(\d)(\d\d\d[\.\,])/, replaceFunction);
+ if (o === s)
break;
}
return s + ' ' + units[unit];