I have an object which which has three different arrays like location vertical and roundType, and i will get a filter object that will have the same three arrays in that object. This is data that needs to be filtered
testObject = [{
"id": 1892928,
"vertical_tax": [
678,
664
],
"location_tax": [
666
],
"roundType": [
"rt1"
],
}
{
"id": 1892927,
"vertical_tax": [
662,
663
],
"location_tax": [
663
],
"roundType": [
"rt2"
],
}]
This is the filter object based on which the filtering should happen
filterObject = {
locations: [666,667]
roundTypes: ["rt1","rt2"]
verticals: [662,661]
}
Original requirements : was to get any of objects with a particular value in either of the filter object arrays. This could be done with use of "some". Update requirements : So i need to filter the main object with the values passed in the filterObject. So all the conditions in filterObject should be matched. All the ids that match should be returned. this can be done with "every"