Share your code. Components are building blocks, you are the architect.

utils/prop-or
v1.1.0
1.1.0
1.0.0
MIT
PUBLIC
3
Build: fail
BuildFail
Build Status: fail
If the given, non-null object has an own property with the specified name,

Please configure Bit as a scoped registry to install components with NPM.Learn more

npm config set '@bit:registry' https://node.bitsrc.io
Use utils/prop-or in your project
npm i @bit/bit.ramda.utils.prop-or
Copied

propOr (val:*, p:String, obj:Object) : *

If the given, non-null object has an own property with the specified name, returns the value of that property. Otherwise returns the provided default value.

Example

var alice = {
       name: 'ALICE',
       age: 101
     };
     var favorite = R.prop('favoriteLibrary');
     var favoriteWithDefault = R.propOr('Ramda', 'favoriteLibrary');

     favorite(alice);  //=> undefined
     favoriteWithDefault(alice);  //=> 'Ramda'

Arguments

val: *

The default value.

p: String

The name of the property to return.

obj: Object

The object to query.

Returns

*

The value of given property of the supplied object or the default value.