client/app/components/converter/converter.service.js
/**
     * Convert a number into octet
     * @param  {number} nb   Number to convert
     * @param  {string} unit Unit of the number
     * @return {number}      the number converted
     */
Convert a number into octet
@param  {number} nb   Number to convert
@param  {string} unit Unit of the number
@return {number}      the number converted
Convert a number into octet @param { number } nb Number to convert @param { string } unit Unit of the number @return { number } the number converted
convertToOctet(nb, unit) {
      if (!_.isNumber(Number(nb)) || !_.isString(unit)) {
        throw new Error('Wrong parameter(s)');
      }
      const baseUnit = _.findIndex(this.def, { unit });
      if (baseUnit < 0) {
        throw new Error('Wrong unit given');
      }
      return this.def[baseUnit].val * nb;
    }
convertToOctet ( nb , unit ) { if ( ! _ . isNumber ( Number ( nb ) ) || ! _ . isString ( unit ) ) { throw new Error ( 'Wrong parameter(s)' ) ; } const baseUnit = _ . findIndex ( this . def , { unit } ) ; if ( baseUnit < 0 ) { throw new Error ( 'Wrong unit given' ) ; } return this . def [ baseUnit ] . val * nb ; }
Convert a number into octet
 @param  {number} nb   Number to convert
 @param  {string} unit Unit of the number
 @return {number}      the number converted
Convert a number into octet @param { number } nb Number to convert @param { string } unit Unit of the number @return { number } the number converted