eqProps.js 810 B

12345678910111213141516171819202122232425262728293031
  1. import _curry3 from "./internal/_curry3.js";
  2. import equals from "./equals.js";
  3. /**
  4. * Reports whether two objects have the same value, in [`R.equals`](#equals)
  5. * terms, for the specified property. Useful as a curried predicate.
  6. *
  7. * @func
  8. * @memberOf R
  9. * @since v0.1.0
  10. * @category Object
  11. * @sig k -> {k: v} -> {k: v} -> Boolean
  12. * @param {String} prop The name of the property to compare
  13. * @param {Object} obj1
  14. * @param {Object} obj2
  15. * @return {Boolean}
  16. *
  17. * @example
  18. *
  19. * const o1 = { a: 1, b: 2, c: 3, d: 4 };
  20. * const o2 = { a: 10, b: 20, c: 3, d: 40 };
  21. * R.eqProps('a', o1, o2); //=> false
  22. * R.eqProps('c', o1, o2); //=> true
  23. */
  24. var eqProps =
  25. /*#__PURE__*/
  26. _curry3(function eqProps(prop, obj1, obj2) {
  27. return equals(obj1[prop], obj2[prop]);
  28. });
  29. export default eqProps;