UNPKG

886 BJavaScriptView Raw
1import _curry2 from "./internal/_curry2.js";
2/**
3 * Returns whether or not an object or its prototype chain has a property with
4 * the specified name
5 *
6 * @func
7 * @memberOf R
8 * @since v0.7.0
9 * @category Object
10 * @sig s -> {s: x} -> Boolean
11 * @param {String} prop The name of the property to check for.
12 * @param {Object} obj The object to query.
13 * @return {Boolean} Whether the property exists.
14 * @example
15 *
16 * function Rectangle(width, height) {
17 * this.width = width;
18 * this.height = height;
19 * }
20 * Rectangle.prototype.area = function() {
21 * return this.width * this.height;
22 * };
23 *
24 * const square = new Rectangle(2, 2);
25 * R.hasIn('width', square); //=> true
26 * R.hasIn('area', square); //=> true
27 */
28
29var hasIn =
30/*#__PURE__*/
31_curry2(function hasIn(prop, obj) {
32 return prop in obj;
33});
34
35export default hasIn;
\No newline at end of file