source: node_modules/ramda-adjunct/src/nonePass.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.0 KB
RevLine 
[d24f17c]1import { complement, compose, anyPass, curryN } from 'ramda';
2
3/**
4 * Takes a list of predicates and returns a predicate that returns true for a given list of
5 * arguments if none of the provided predicates are satisfied by those arguments. It is the
6 * complement of Ramda's anyPass.
7 *
8 * The function returned is a curried function whose arity matches that of the
9 * highest-arity predicate.
10 *
11 * @func nonePass
12 * @memberOf RA
13 * @since {@link https://char0n.github.io/ramda-adjunct/2.5.0|v2.5.0}
14 * @category Logic
15 * @sig [(*... -> Boolean)] -> (*... -> Boolean)
16 * @param {Array} predicates An array of predicates to check
17 * @return {Function} The combined predicate
18 * @see {@link http://ramdajs.com/docs/#anyPass|R.anyPass}
19 * @example
20 *
21 * const gt10 = R.gt(R.__, 10)
22 * const even = (x) => x % 2 === 0;
23 * const f = RA.nonePass([gt10, even]);
24 *
25 * f(12); //=> false
26 * f(8); //=> false
27 * f(11); //=> false
28 * f(9); //=> true
29 */
30const nonePass = curryN(1, compose(complement, anyPass));
31
32export default nonePass;
Note: See TracBrowser for help on using the repository browser.