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.

28 lines
749 B

4 years ago
  1. import lift from "./lift.js";
  2. import not from "./not.js";
  3. /**
  4. * Takes a function `f` and returns a function `g` such that if called with the same arguments
  5. * when `f` returns a "truthy" value, `g` returns `false` and when `f` returns a "falsy" value `g` returns `true`.
  6. *
  7. * `R.complement` may be applied to any functor
  8. *
  9. * @func
  10. * @memberOf R
  11. * @since v0.12.0
  12. * @category Logic
  13. * @sig (*... -> *) -> (*... -> Boolean)
  14. * @param {Function} f
  15. * @return {Function}
  16. * @see R.not
  17. * @example
  18. *
  19. * const isNotNil = R.complement(R.isNil);
  20. * isNil(null); //=> true
  21. * isNotNil(null); //=> false
  22. * isNil(7); //=> false
  23. * isNotNil(7); //=> true
  24. */
  25. var complement =
  26. /*#__PURE__*/
  27. lift(not);
  28. export default complement;