[d24f17c] | 1 | "use strict";
|
---|
| 2 |
|
---|
| 3 | exports.__esModule = true;
|
---|
| 4 | exports["default"] = void 0;
|
---|
| 5 | var _ramda = require("ramda");
|
---|
| 6 | var inRangeImp = (0, _ramda.ifElse)(_ramda.gte, function () {
|
---|
| 7 | throw new Error('low must not be greater than high in inRange(low, high, value)');
|
---|
| 8 | }, (0, _ramda.useWith)(_ramda.both, [_ramda.lte, _ramda.gt]));
|
---|
| 9 |
|
---|
| 10 | /**
|
---|
| 11 | * Checks if `value` is between `low` and up to but not including `high`.
|
---|
| 12 | *
|
---|
| 13 | * @func inRange
|
---|
| 14 | * @memberOf RA
|
---|
| 15 | * @since {@link https://char0n.github.io/ramda-adjunct/2.7.0|v2.7.0}
|
---|
| 16 | * @category Relation
|
---|
| 17 | * @sig Number -> Number -> Number -> Boolean
|
---|
| 18 | * @param {number} low Start of the range
|
---|
| 19 | * @param {number} high The end of the range
|
---|
| 20 | * @param {number} value The value to test
|
---|
| 21 | * @return {boolean}
|
---|
| 22 | * @throws {Error} When `low` is greater than or equal to `high`
|
---|
| 23 | * @example
|
---|
| 24 | *
|
---|
| 25 | * RA.inRange(0, 5, 3); //=> true
|
---|
| 26 | * RA.inRange(0, 5, 0); //=> true
|
---|
| 27 | * RA.inRange(0, 5, 4); //=> true
|
---|
| 28 | * RA.inRange(0, 5, 5); //=> false
|
---|
| 29 | * RA.inRange(0, 5, -1); //=> false
|
---|
| 30 | */
|
---|
| 31 | var _default = (0, _ramda.curry)(function (low, high, value) {
|
---|
| 32 | return inRangeImp(low, high)(value);
|
---|
| 33 | });
|
---|
| 34 | exports["default"] = _default; |
---|