assertFactor function

void assertFactor(
  1. int factor
)

Assert that the factor value is somewhere from 0 - 100. Will throw InvalidValueRangeException if not in range.

Implementation

void assertFactor(int factor) {
  const range = (lower: 0, upper: 100);
  if (_inRange(range: range, value: factor)) return;
  throw InvalidValueRangeException(
    value: factor,
    range: range,
  );
}