I have an array of > 1000 objects, each with a nested array that looks something like that:
data = [{
"id": 0,
"location": "A",
"basket": [
"milk",
"bread",
"sugar",
"water"
],
}, {
"id": 1,
"location": "B",
"basket": [
"chocolate",
"cereal",
"sugar",
"sauce"
],
}, {
"id": 2,
"location": "C",
"basket": [
"milk",
"cereal",
"soda",
"flour"
],
}]
I have a multi-select dropdown menu that has the list of all items in the "basket" nested array. When I select "sugar", it should be able to return the objects with id=0 and id=1 or if I select both "water" and "milk" should return objects with id=0 and id=2. I have tried using a combination of _.map _.find _.filter, but it doesn't work. Also tried looking for similar questions here, but didn't find one. prefer to use lodash if possible.