lodash where method is not considering nested array elements when searching. Consider the below example:
var foo = [
{
"id": "123",
"elements": [
{
"id": "1231",
"name": "foo1"
},
{
"id": "1232",
"name": "bar1"
}
]
},
{
"id": "456",
"items": [
{
"id": "4561",
"name": "foo2"
},
{
"id": "4562",
"name": "bar2"
}
]
}
]
_.where(foo, { 'id' : '123' } ) //works and returns the element
_.where(foo, { 'id' : '1231' } ) //fails.. trying to match the first element in the elements array. does not return matched element
Is there an API in lodash or other JavaScript library to perform deep search?