checkParams.js 359 B

123456789101112
  1. /**
  2. * @description Check if access is out of bounds.
  3. * @param pos The position want to access.
  4. * @param lower The lower bound.
  5. * @param upper The upper bound.
  6. * @return Boolean about if access is out of bounds.
  7. */
  8. export function checkWithinAccessParams(pos, lower, upper) {
  9. if (pos < lower || pos > upper) {
  10. throw new RangeError();
  11. }
  12. }