import * as BN from 'bn.js' ; export default function toFriendlyCryptoVal ( longCryptoVal , decimalCount ? ) { decimalCount = decimalCount || 3 ; decimalCount = decimalCount > 17 ? 17 : decimalCount ; decimalCount = decimalCount < 0 ? 0 : decimalCount ; const longVal = new BN ( longCryptoVal . toString ( ) ) ; const friendlyCryptoVal = longVal . div ( new BN ( 10 ) . pow ( new BN ( 18 - decimalCount ) ) ) . toNumber ( ) / Math . pow ( 10 , decimalCount ) ; return friendlyCryptoVal ; }