So I have objects that I want to be able to search for any matches of values.
For example:
let arr = [
{
a: 'foo',
b: 'bar'
},
{
a: 'bar',
b: 'baz'
},
{
a: 'foo',
b: 'baz'
}
];
and I want to be able to filter the array to contain any object that has a property with the value 'foo'.
Is there a way to do this with lodash? Something like:
_.filter(arr, function(obj) {
return obj.anyPropertiesMatch('bar');
});