path-eq

v0.9.6arrow_drop_down
v0.9.6
STATUS
Passing
DOWNLOADS
2
VISIBILITY
Public
PUBLISHED
5 years ago
SIZE
2 KB
Determines whether a nested path on an object has a specific value, in [`R.equals`](#equals) terms.
1 contributor
Install path-eq as a package?
Copied
npm i @bit/justin-capalbo.ramda.path-eq
Set Bit as a scoped registryLearn more
npm config set '@bit:registry' https://node.bit.cloud
Component Example
React
React
Vue
Angular
React Native
Add dependency... help_outline
Just
import
any of the 1 million components
and packages in Bit or NPM to the example.
import Button from '@bit/grommet.grommet.button';
import Lodash from 'lodash';
toggle layout
No preview available
modifieddraft
chevron_left
chevron_right
pathEq (
path:Array,
val:*,
obj:Object
) : Boolean

Determines whether a nested path on an object has a specific value, in R.equals terms. Most likely used to filter a list.

Example
const user1 = { address: { zipCode: 90210 } };
     const user2 = { address: { zipCode: 55555 } };
     const user3 = { name: 'Bob' };
     const users = [ user1, user2, user3 ];
     const isFamous = R.pathEq(['address', 'zipCode'], 90210);
     R.filter(isFamous, users); //=> [ user1 ]
Arguments
path: Array

The path of the nested property to use

val: *

The value to compare the nested property with

obj: Object

The object to check the nested property in

Returns
Boolean

`true` if the value equals the nested object property, `false` otherwise.

Help and resources