src/index.js
function getValueOfUnit(unitInput) {
  const unit = unitInput ? unitInput.toLowerCase() : 'ether';
  var unitValue = unitMap[unit]; // eslint-disable-line

  if (typeof unitValue !== 'string') {
    throw new Error(`[ethjs-unit] the unit provided ${unitInput} doesn't exists, please use the one of the following units ${JSON.stringify(unitMap, null, 2)}`);
  }

  return new BN(unitValue, 10);
}
function getValueOfUnit(unitInput) {
  const unit = unitInput ? unitInput.toLowerCase() : 'ether';
  var unitValue = unitMap[unit]; // eslint-disable-line

  if (typeof unitValue !== 'string') {
    throw new Error(`[ethjs-unit] the unit provided ${unitInput} doesn't exists, please use the one of the following units ${JSON.stringify(unitMap, null, 2)}`);
  }

  return new BN(unitValue, 10);
}
function getValueOfUnit ( unitInput ) { const unit = unitInput ? unitInput . toLowerCase ( ) : 'ether' ; var unitValue = unitMap [ unit ] ; // eslint-disable-line if ( typeof unitValue !== 'string' ) { throw new Error ( ` ${ unitInput } ${ JSON . stringify ( unitMap , null , 2 ) } ` ) ; } return new BN ( unitValue , 10 ) ; }
Returns value of unit in Wei

@method getValueOfUnit
@param {String} unit the unit to convert to, default ether
@returns {BigNumber} value of the unit (in Wei)
@throws error if the unit is not correct:w
Returns value of unit in Wei