inRange.js 248 B

1234567891011
  1. /**
  2. * Checks if value is inside the range.
  3. */
  4. function inRange(val, min, max, threshold){
  5. threshold = threshold || 0;
  6. return (val + threshold >= min && val - threshold <= max);
  7. }
  8. module.exports = inRange;