Skip to content

Instantly share code, notes, and snippets.

@squalvj
Last active September 12, 2018 08:28
Show Gist options
  • Save squalvj/bd67a2c7f2687dd8dc7860455f412494 to your computer and use it in GitHub Desktop.
Save squalvj/bd67a2c7f2687dd8dc7860455f412494 to your computer and use it in GitHub Desktop.
let data = [
{
id: 1,
name: 'test',
category: 'Kitchen'
},
{
id: 2,
name: 'Bacon',
category: 'Fork'
},
{
id: 3,
name: 'Beef',
category: 'Meat'
}
]
let mutate = data.filter((obj)=>{
return Object.keys(obj).reduce((acc, curr)=>{
// put the searching input inside includes function
return acc || obj[curr].toString().toLowerCase().includes('');
}, false);
});
console.log(mutate)
@squalvj
Copy link
Author

squalvj commented Aug 30, 2018

for searching array of object tjuy

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment