propSatisfies.js 729 B

1234567891011121314151617181920212223242526272829
  1. import _curry3 from "./internal/_curry3.js";
  2. import prop from "./prop.js";
  3. /**
  4. * Returns `true` if the specified object property satisfies the given
  5. * predicate; `false` otherwise. You can test multiple properties with
  6. * [`R.where`](#where).
  7. *
  8. * @func
  9. * @memberOf R
  10. * @since v0.16.0
  11. * @category Logic
  12. * @sig (a -> Boolean) -> String -> {String: a} -> Boolean
  13. * @param {Function} pred
  14. * @param {String} name
  15. * @param {*} obj
  16. * @return {Boolean}
  17. * @see R.where, R.propEq, R.propIs
  18. * @example
  19. *
  20. * R.propSatisfies(x => x > 0, 'x', {x: 1, y: 2}); //=> true
  21. */
  22. var propSatisfies =
  23. /*#__PURE__*/
  24. _curry3(function propSatisfies(pred, name, obj) {
  25. return pred(prop(name, obj));
  26. });
  27. export default propSatisfies;