1 | var _curry3 =
|
2 | /*#__PURE__*/
|
3 | require("./internal/_curry3");
|
4 |
|
5 | var pathOr =
|
6 | /*#__PURE__*/
|
7 | require("./pathOr");
|
8 | /**
|
9 | * If the given, non-null object has an own property with the specified name,
|
10 | * returns the value of that property. Otherwise returns the provided default
|
11 | * value.
|
12 | *
|
13 | * @func
|
14 | * @memberOf R
|
15 | * @since v0.6.0
|
16 | * @category Object
|
17 | * @sig a -> String -> Object -> a
|
18 | * @param {*} val The default value.
|
19 | * @param {String} p The name of the property to return.
|
20 | * @param {Object} obj The object to query.
|
21 | * @return {*} The value of given property of the supplied object or the default value.
|
22 | * @example
|
23 | *
|
24 | * const alice = {
|
25 | * name: 'ALICE',
|
26 | * age: 101
|
27 | * };
|
28 | * const favorite = R.prop('favoriteLibrary');
|
29 | * const favoriteWithDefault = R.propOr('Ramda', 'favoriteLibrary');
|
30 | *
|
31 | * favorite(alice); //=> undefined
|
32 | * favoriteWithDefault(alice); //=> 'Ramda'
|
33 | */
|
34 |
|
35 |
|
36 | var propOr =
|
37 | /*#__PURE__*/
|
38 | _curry3(function propOr(val, p, obj) {
|
39 | return pathOr(val, [p], obj);
|
40 | });
|
41 |
|
42 | module.exports = propOr; |
\ | No newline at end of file |