source: node_modules/ramda-adjunct/lib/neither.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 false if the first function is truth-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 truth-y value. In short it will return true if neither predicate
13 * returns true.
14 *
15 * In addition to functions, `RA.neither` also accepts any fantasy-land compatible
16 * applicative functor.
17 *
18 * @func neither
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/#either|R.either}, {@link http://ramdajs.com/docs/#or|R.or}
27 * @example
28 *
29 * const gt10 = R.gt(R.__, 10)
30 * const even = (x) => x % 2 === 0;
31 * const f = RA.neither(gt10, even);
32 *
33 * f(12); //=> false
34 * f(8); //=> false
35 * f(11); //=> false
36 * f(9); //=> true
37 */
38/* eslint-enable max-len */
39var neither = (0, _ramda.curry)((0, _ramda.compose)(_ramda.complement, _ramda.either));
40var _default = neither;
41exports["default"] = _default;
Note: See TracBrowser for help on using the repository browser.