Guest User

Untitled

a guest
Dec 17th, 2018
70
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.64 KB | None | 0 0
  1. const config = {
  2. coinDecimalPlaces: 6,
  3. coinDifficultyTarget: 120,
  4. coinUnits: 100000000,
  5. symbol: 'BCN'
  6. };
  7.  
  8. function getCoinDecimalPlaces() {
  9. if (typeof coinDecimalPlaces != "undefined") return coinDecimalPlaces;
  10. else if (config.coinDecimalPlaces) return config.coinDecimalPlaces;
  11. else lastStats.config.coinUnits.toString().length - 1;
  12. }
  13.  
  14. function getReadableCoins(coins, digits, withoutSymbol){
  15. var coinDecimalPlaces = getCoinDecimalPlaces();
  16. var amount = parseFloat((parseInt(coins || 0) / config.coinUnits).toFixed(digits || coinDecimalPlaces));
  17. return amount.toString() + (withoutSymbol ? '' : (' ' + config.symbol));
  18. }
Add Comment
Please, Sign In to add comment