ramda-adjunct
Version:
Ramda Adjunct is the most popular and most comprehensive set of utilities for use with Ramda, providing a variety of useful, well tested functions with excellent documentation.
45 lines (40 loc) • 1.55 kB
JavaScript
exports.__esModule = true;
exports["default"] = void 0;
var _ramda = require("ramda");
/* eslint-disable max-len */
/**
* A function which calls the two provided functions and returns the complement of `||`ing the
* results.
* It returns false if the first function is truth-y and the complement of the second function
* otherwise. Note that this is short-circuited, meaning that the second function will not be
* invoked if the first returns a truth-y value. In short it will return true if neither predicate
* returns true.
*
* In addition to functions, `RA.neither` also accepts any fantasy-land compatible
* applicative functor.
*
* @func neither
* @memberOf RA
* @since {@link https://char0n.github.io/ramda-adjunct/2.3.0|v2.3.0}
* @category Logic
* @sig (*... -> Boolean) -> (*... -> Boolean) -> (*... -> Boolean)
* @param {Function} f A predicate
* @param {Function} g Another predicate
* @return {Function} Returns a function that applies its arguments to `f` and `g` and returns the complement of `||`ing their outputs together.
* @see {@link http://ramdajs.com/docs/#either|R.either}, {@link http://ramdajs.com/docs/#or|R.or}
* @example
*
* const gt10 = R.gt(R.__, 10)
* const even = (x) => x % 2 === 0;
* const f = RA.neither(gt10, even);
*
* f(12); //=> false
* f(8); //=> false
* f(11); //=> false
* f(9); //=> true
*/
/* eslint-enable max-len */
var neither = (0, _ramda.curry)((0, _ramda.compose)(_ramda.complement, _ramda.either));
var _default = neither;
exports["default"] = _default;
;