propIs.js 749 B

12345678910111213141516171819202122232425262728293031
  1. import _curry3 from "./internal/_curry3.js";
  2. import prop from "./prop.js";
  3. import is from "./is.js";
  4. /**
  5. * Returns `true` if the specified object property is of the given type;
  6. * `false` otherwise.
  7. *
  8. * @func
  9. * @memberOf R
  10. * @since v0.16.0
  11. * @category Type
  12. * @sig Type -> String -> Object -> Boolean
  13. * @param {Function} type
  14. * @param {String} name
  15. * @param {*} obj
  16. * @return {Boolean}
  17. * @see R.is, R.propSatisfies
  18. * @example
  19. *
  20. * R.propIs(Number, 'x', {x: 1, y: 2}); //=> true
  21. * R.propIs(Number, 'x', {x: 'foo'}); //=> false
  22. * R.propIs(Number, 'x', {}); //=> false
  23. */
  24. var propIs =
  25. /*#__PURE__*/
  26. _curry3(function propIs(type, name, obj) {
  27. return is(type, prop(name, obj));
  28. });
  29. export default propIs;