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

utils/path-or
v1.1.0
1.1.0
MIT
PUBLIC
3
Build: fail
BuildFail
Build Status: fail
If the given, non-null object has a value at the given path, returns the

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/path-or in your project
npm i @bit/bit.ramda.utils.path-or
Copied

pathOr (d:*, p:Array, obj:Object) : *

If the given, non-null object has a value at the given path, returns the value at that path. Otherwise returns the provided default value.

Example

R.pathOr('N/A', ['a', 'b'], {a: {b: 2}}); //=> 2
     R.pathOr('N/A', ['a', 'b'], {c: {b: 2}}); //=> "N/A"

Arguments

d: *

The default value.

p: Array

The path to use.

obj: Object

The object to retrieve the nested property from.

Returns

*

The data at `path` of the supplied object or the default value.