Merge pull request #100 from lbryio/to-fixed
fix creditsToString function for small decimals
This commit is contained in:
commit
6139cede26
2 changed files with 5 additions and 14 deletions
11
dist/bundle.js
vendored
11
dist/bundle.js
vendored
|
@ -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,12 +4556,8 @@ function formatFullPrice(amount) {
|
||||||
}
|
}
|
||||||
|
|
||||||
function creditsToString(amount) {
|
function creditsToString(amount) {
|
||||||
var creditString = String(amount);
|
var creditString = parseFloat(amount).toFixed(8);
|
||||||
|
return creditString;
|
||||||
if (creditString.includes('.')) {
|
|
||||||
return creditString;
|
|
||||||
}
|
|
||||||
return creditString + '.0';
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/***/ }),
|
/***/ }),
|
||||||
|
|
|
@ -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);
|
||||||
|
return creditString;
|
||||||
if (creditString.includes('.')) {
|
|
||||||
return creditString;
|
|
||||||
}
|
|
||||||
return `${creditString}.0`;
|
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue