source: node_modules/ramda-adjunct/lib/notBoth.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.5 KB
Line 
1"use strict";
2
3exports.__esModule = true;
4exports["default"] = void 0;
5var _ramda = require("ramda");
6/* eslint-disable max-len */
7/**
8 * A function which calls the two provided functions and returns the complement of `&&`ing the
9 * results.
10 * It returns true if the first function is false-y and the complement of the second function
11 * otherwise. Note that this is short-circuited, meaning that the second function will not be
12 * invoked if the first returns a false-y value. In short it will return true unless both predicates
13 * return true.
14 *
15 * In addition to functions, `RA.notBoth` also accepts any fantasy-land compatible
16 * applicative functor.
17 *
18 * @func notBoth
19 * @memberOf RA
20 * @since {@link https://char0n.github.io/ramda-adjunct/2.3.0|v2.3.0}
21 * @category Logic
22 * @sig (*... -> Boolean) -> (*... -> Boolean) -> (*... -> Boolean)
23 * @param {Function} f A predicate
24 * @param {Function} g Another predicate
25 * @return {Function} Returns a function that applies its arguments to `f` and `g` and returns the complement of `&&`ing their outputs together.
26 * @see {@link http://ramdajs.com/docs/#both|R.both}
27 * @example
28 *
29 * const gt10 = R.gt(R.__, 10)
30 * const even = (x) => x % 2 === 0;
31 * const f = RA.notBoth(gt10, even);
32 *
33 * f(12); //=> false
34 * f(8); //=> true
35 * f(11); //=> true
36 * f(9); //=> true
37 */
38/* eslint-enable max-len */
39var notBoth = (0, _ramda.curry)((0, _ramda.compose)(_ramda.complement, _ramda.both));
40var _default = notBoth;
41exports["default"] = _default;
Note: See TracBrowser for help on using the repository browser.