eqBy.js 582 B

123456789101112131415161718192021222324252627
  1. import _curry3 from "./internal/_curry3.js";
  2. import equals from "./equals.js";
  3. /**
  4. * Takes a function and two values in its domain and returns `true` if the
  5. * values map to the same value in the codomain; `false` otherwise.
  6. *
  7. * @func
  8. * @memberOf R
  9. * @since v0.18.0
  10. * @category Relation
  11. * @sig (a -> b) -> a -> a -> Boolean
  12. * @param {Function} f
  13. * @param {*} x
  14. * @param {*} y
  15. * @return {Boolean}
  16. * @example
  17. *
  18. * R.eqBy(Math.abs, 5, -5); //=> true
  19. */
  20. var eqBy =
  21. /*#__PURE__*/
  22. _curry3(function eqBy(f, x, y) {
  23. return equals(f(x), f(y));
  24. });
  25. export default eqBy;