UNPKG

typedash

Version:

modern, type-safe collection of utility functions

18 lines (17 loc) 558 B
// src/functions/inRange/inRange.ts function inRange(value, range, options) { const [start, end] = range; const { inclusive = "start" } = options ?? {}; if (start > end) { throw new RangeError(`Invalid range: [${start},${end}]`); } return { true: () => value >= start && value <= end, false: () => value > start && value < end, start: () => value >= start && value < end, end: () => value > start && value <= end }[inclusive](); } export { inRange }; //# sourceMappingURL=out.js.map //# sourceMappingURL=chunk-LHRS6LOQ.js.map