source: node_modules/ramda-adjunct/lib/inRange.js

main
Last change on this file was d24f17c, checked in by Aleksandar Panovski <apano77@…>, 15 months ago

Initial commit

  • Property mode set to 100644
File size: 1.1 KB
Line 
1"use strict";
2
3exports.__esModule = true;
4exports["default"] = void 0;
5var _ramda = require("ramda");
6var 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 */
31var _default = (0, _ramda.curry)(function (low, high, value) {
32 return inRangeImp(low, high)(value);
33});
34exports["default"] = _default;
Note: See TracBrowser for help on using the repository browser.