code: function convertSubunitAmount(amountSubUnit, rate, fromCurrency, toCurrency) {
    const exponent = -getDecimalsForCurrency(fromCurrency) + getDecimalsForCurrency(toCurrency);
  
    return amountSubUnit * rate * Math.pow(10, exponent);
  }
docs: Convert between sub-unit amounts of two currencies with a given rate,
  correctly converting between sub-units with different decimal amounts.
  E.g. to convert 1 BTC to USD at rate 250, call
  convertSubunitAmount( 100000000, 250, 'BTC', 'USD' )
  
  @param {int}     amountSubUnit Amount to convert, denominated
  in smallest sub-unit of $from_currency
  @param {number}  rate           Rate to multiply the amount (non-sub-unit) with
  in order to convert.
  @param {string}  fromCurrency  Currency denominating input amount (amountSubUnit)
  @param {string}  toCurrency    Currency denominating output.
  
  @return number