Quantcast
Channel: Active questions tagged react-native+typescript - Stack Overflow
Viewing all articles
Browse latest Browse all 6213

Filtering objects based on conditions using Ramda

$
0
0

I want to filter out below data using Ramda. The desired result is to show the properties where usage === 'Defining'.

const data = [{"attributes":  [    {"usage": "Descriptive"},    {"usage": "Defining"}  ]}]

So far this is what i have done and it's not filtering out data and returning the whole object.

R.filter( R.compose(     R.any(R.propEq('usage', 'Defining')),     R.prop('attributes')  ))(data)

Below is the desired result that i want to acheive:

[{"attributes":  [    {"usage": "Defining"}  ]}]

Viewing all articles
Browse latest Browse all 6213

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>