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:
915 bytes
|
Line | |
---|
1 | import _curry2 from "./internal/_curry2.js";
|
---|
2 | import hasPath from "./hasPath.js";
|
---|
3 | /**
|
---|
4 | * Returns whether or not an object has an own property with 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 | * const hasName = R.has('name');
|
---|
17 | * hasName({name: 'alice'}); //=> true
|
---|
18 | * hasName({name: 'bob'}); //=> true
|
---|
19 | * hasName({}); //=> false
|
---|
20 | *
|
---|
21 | * const point = {x: 0, y: 0};
|
---|
22 | * const pointHas = R.has(R.__, point);
|
---|
23 | * pointHas('x'); //=> true
|
---|
24 | * pointHas('y'); //=> true
|
---|
25 | * pointHas('z'); //=> false
|
---|
26 | */
|
---|
27 |
|
---|
28 | var has =
|
---|
29 | /*#__PURE__*/
|
---|
30 | _curry2(function has(prop, obj) {
|
---|
31 | return hasPath([prop], obj);
|
---|
32 | });
|
---|
33 |
|
---|
34 | export default has; |
---|
Note:
See
TracBrowser
for help on using the repository browser.