src/index.js
function resolveFraction(frac) {
  frac = `${frac}`;
  if (Patterns.Percentage.test(frac)) {
    return parseFloat(frac) / 100;
  } else if (Patterns.Number.test(frac)) {
    return parseFloat(frac);
  } else
    throw new Error('Unknown fraction format: ', inp);
}
function resolveFraction(frac) {
  frac = `${frac}`;
  if (Patterns.Percentage.test(frac)) {
    return parseFloat(frac) / 100;
  } else if (Patterns.Number.test(frac)) {
    return parseFloat(frac);
  } else
    throw new Error('Unknown fraction format: ', inp);
}
function resolveFraction ( frac ) { frac = ` ${ frac } ` ; if ( Patterns . Percentage . test ( frac ) ) { return parseFloat ( frac ) / 100 ; } else if ( Patterns . Number . test ( frac ) ) { return parseFloat ( frac ) ; } else throw new Error ( 'Unknown fraction format: ' , inp ) ; }
Get a decimal value from a percentage or a number.
@param {String|Number} frac - the value to be converted to a decimal fraction
@return - a decimal value equivalent to the input
@example
resolveFraction('25%');   // 0.25
resolveFraction('0.25');  // 0.25
Get a decimal value from a percentage or a number .