enkidevs / react-search-input

:mag: Simple react.js component for a search input, providing a filter function.
302 stars 72 forks source link

how to filter array as a key ? #99

Closed tahayk closed 7 years ago

tahayk commented 7 years ago

Hello

Is it possible to filter an array of objects that contains arrays ? like this:

tab=[ 
{ a:[1,2,3],
 name:"lorem"
},
{ b:[8,2],
 name:"ipsum"
}
 ]
KEYS_TO_FILTERS=['name','a']
mathieudutour commented 7 years ago

yes it's possible. You can also filter an array of objects that contains an array of objects ;)

tab=[ 
{ a:[{b: 1}],
 name:"lorem"
},
 ]
KEYS_TO_FILTERS=['name','a.b']