I have the following array of values:
[
{
id: 1,
field: 'map'
},
{
id: 2,
field: 'dog'
},
{
id: 3,
field: 'map'
}
]
I need to find out elements with field equals dog and map. I know I could use the _.filter method and pass an iterator function, but what I want to know is whether or not there's a better solution to this issue where I could pass search field and possible values. Could someone provide a better way of doing so?
EDIT::
I could use the following approach:
_.where(array, {field: 'dog'})
But here I may check only one clause