main
Last change
on this file was d24f17c, checked in by Aleksandar Panovski <apano77@…>, 15 months ago |
Initial commit
|
-
Property mode
set to
100644
|
File size:
999 bytes
|
Line | |
---|
1 | var _curry2 =
|
---|
2 | /*#__PURE__*/
|
---|
3 | require("./internal/_curry2.js");
|
---|
4 |
|
---|
5 | var isNil =
|
---|
6 | /*#__PURE__*/
|
---|
7 | require("./isNil.js");
|
---|
8 | /**
|
---|
9 | * Returns whether or not an object or its prototype chain has a property with
|
---|
10 | * the specified name
|
---|
11 | *
|
---|
12 | * @func
|
---|
13 | * @memberOf R
|
---|
14 | * @since v0.7.0
|
---|
15 | * @category Object
|
---|
16 | * @sig s -> {s: x} -> Boolean
|
---|
17 | * @param {String} prop The name of the property to check for.
|
---|
18 | * @param {Object} obj The object to query.
|
---|
19 | * @return {Boolean} Whether the property exists.
|
---|
20 | * @example
|
---|
21 | *
|
---|
22 | * function Rectangle(width, height) {
|
---|
23 | * this.width = width;
|
---|
24 | * this.height = height;
|
---|
25 | * }
|
---|
26 | * Rectangle.prototype.area = function() {
|
---|
27 | * return this.width * this.height;
|
---|
28 | * };
|
---|
29 | *
|
---|
30 | * const square = new Rectangle(2, 2);
|
---|
31 | * R.hasIn('width', square); //=> true
|
---|
32 | * R.hasIn('area', square); //=> true
|
---|
33 | */
|
---|
34 |
|
---|
35 |
|
---|
36 | var hasIn =
|
---|
37 | /*#__PURE__*/
|
---|
38 | _curry2(function hasIn(prop, obj) {
|
---|
39 | if (isNil(obj)) {
|
---|
40 | return false;
|
---|
41 | }
|
---|
42 |
|
---|
43 | return prop in obj;
|
---|
44 | });
|
---|
45 |
|
---|
46 | module.exports = hasIn; |
---|
Note:
See
TracBrowser
for help on using the repository browser.