lib/bench.js
function assertThresholds(thresholds) {
  if (!elv(thresholds)) return null;

  if (typeof thresholds !== 'object') {
    throw new TypeError(msg.argThresholds);
  }

  const avg = elv.coalesce(thresholds.avg, false);
  const max = elv.coalesce(thresholds.max, false);
  const min = elv.coalesce(thresholds.min, false);
  const { target } = thresholds;

  if (avg !== false && typeof avg !== 'number') {
    throw new TypeError(msg.argAvg);
  }

  if (max !== false && typeof max !== 'number') {
    throw new TypeError(msg.argMax);
  }

  if (min !== false && typeof min !== 'number') {
    throw new TypeError(msg.argMin);
  }

  if (!Number.isInteger(target) || target < 0) {
    throw new TypeError(msg.argTarget);
  }

  return {
    avg,
    max,
    min,
    target,
  };
}
function assertThresholds(thresholds) {
  if (!elv(thresholds)) return null;

  if (typeof thresholds !== 'object') {
    throw new TypeError(msg.argThresholds);
  }

  const avg = elv.coalesce(thresholds.avg, false);
  const max = elv.coalesce(thresholds.max, false);
  const min = elv.coalesce(thresholds.min, false);
  const { target } = thresholds;

  if (avg !== false && typeof avg !== 'number') {
    throw new TypeError(msg.argAvg);
  }

  if (max !== false && typeof max !== 'number') {
    throw new TypeError(msg.argMax);
  }

  if (min !== false && typeof min !== 'number') {
    throw new TypeError(msg.argMin);
  }

  if (!Number.isInteger(target) || target < 0) {
    throw new TypeError(msg.argTarget);
  }

  return {
    avg,
    max,
    min,
    target,
  };
}
function assertThresholds ( thresholds ) { if ( ! elv ( thresholds ) ) return null ; if ( typeof thresholds !== 'object' ) { throw new TypeError ( msg . argThresholds ) ; } const avg = elv . coalesce ( thresholds . avg , false ) ; const max = elv . coalesce ( thresholds . max , false ) ; const min = elv . coalesce ( thresholds . min , false ) ; const { target } = thresholds ; if ( avg !== false && typeof avg !== 'number' ) { throw new TypeError ( msg . argAvg ) ; } if ( max !== false && typeof max !== 'number' ) { throw new TypeError ( msg . argMax ) ; } if ( min !== false && typeof min !== 'number' ) { throw new TypeError ( msg . argMin ) ; } if ( ! Number . isInteger ( target ) || target < 0 ) { throw new TypeError ( msg . argTarget ) ; } return { avg , max , min , target , } ; }
Validates threshold options.  If it is invalid a TypeError is thrown.
Otherwise, a normalized thresholds object or null is returned.

@param {object} thresholds

@returns {object}
Validates threshold options . If it is invalid a TypeError is thrown . Otherwise a normalized thresholds object or null is returned .