You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

35 lines
1017 B

4 years ago
  1. import _complement from "./internal/_complement.js";
  2. import _curry2 from "./internal/_curry2.js";
  3. import all from "./all.js";
  4. /**
  5. * Returns `true` if no elements of the list match the predicate, `false`
  6. * otherwise.
  7. *
  8. * Dispatches to the `all` method of the second argument, if present.
  9. *
  10. * Acts as a transducer if a transformer is given in list position.
  11. *
  12. * @func
  13. * @memberOf R
  14. * @since v0.12.0
  15. * @category List
  16. * @sig (a -> Boolean) -> [a] -> Boolean
  17. * @param {Function} fn The predicate function.
  18. * @param {Array} list The array to consider.
  19. * @return {Boolean} `true` if the predicate is not satisfied by every element, `false` otherwise.
  20. * @see R.all, R.any
  21. * @example
  22. *
  23. * const isEven = n => n % 2 === 0;
  24. * const isOdd = n => n % 2 === 1;
  25. *
  26. * R.none(isEven, [1, 3, 5, 7, 9, 11]); //=> true
  27. * R.none(isOdd, [1, 3, 5, 7, 8, 11]); //=> false
  28. */
  29. var none =
  30. /*#__PURE__*/
  31. _curry2(function none(fn, input) {
  32. return all(_complement(fn), input);
  33. });
  34. export default none;