Last active
September 12, 2018 08:28
-
-
Save squalvj/bd67a2c7f2687dd8dc7860455f412494 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
for searching array of object tjuy