11 lines
257 B
JavaScript
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);
|
|
}
|
|
};
|