Merge pull request #100 from lbryio/to-fixed

fix creditsToString function for small decimals
This commit is contained in:
Sean Yesmunt 2018-11-08 15:53:20 -05:00 committed by GitHub
commit 6139cede26
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
2 changed files with 5 additions and 14 deletions

9
dist/bundle.js vendored
View file

@ -1921,8 +1921,7 @@ function doAbandonClaim(txid, nout) {
var _myClaims$find = myClaims.find(function (claim) { var _myClaims$find = myClaims.find(function (claim) {
return claim.txid === txid && claim.nout === nout; return claim.txid === txid && claim.nout === nout;
}), }),
claimId = _myClaims$find.claim_id, claimId = _myClaims$find.claim_id;
name = _myClaims$find.name;
dispatch({ dispatch({
type: ACTIONS.ABANDON_CLAIM_STARTED, type: ACTIONS.ABANDON_CLAIM_STARTED,
@ -4557,13 +4556,9 @@ function formatFullPrice(amount) {
} }
function creditsToString(amount) { function creditsToString(amount) {
var creditString = String(amount); var creditString = parseFloat(amount).toFixed(8);
if (creditString.includes('.')) {
return creditString; return creditString;
} }
return creditString + '.0';
}
/***/ }), /***/ }),
/* 26 */ /* 26 */

View file

@ -24,10 +24,6 @@ export function formatFullPrice(amount, precision = 1) {
} }
export function creditsToString(amount) { export function creditsToString(amount) {
const creditString = String(amount); const creditString = parseFloat(amount).toFixed(8);
if (creditString.includes('.')) {
return creditString; return creditString;
} }
return `${creditString}.0`;
}