contracts/lib/utils/kredits-formatter.js
Michael Bumann 3cb94fb660 Add kredits-formatter and additionally format balance
This adds a `balanceInt` value to the contributor data that has the
token balance formatted as full Kredits. (similar to Ether)
2019-04-19 11:57:35 +02:00

11 lines
257 B
JavaScript

const ethersUtils = require('ethers').utils;
module.exports = function (value, options = {}) {
let etherValue = ethersUtils.formatEther(value);
if (options.asFloat) {
return parseFloat(etherValue);
} else {
return parseInt(etherValue);
}
}