Is there a way to efficiently find matching items in an array of objects using a filter object that only includes a subset of the array properties? For instance, consider a customer:
let Customer = {
Name: "John Doe",
Age: 80,
Hair: "Red",
Gender: "Male",
};
Let's say we have a search object:
let searchObject ={
Hair: "Red",
Gender: "Male"
}
Instead of manually filtering the array like this:
this.array.filter(z=>z.Hair == searchObject.Hair && z.Gender == searchObject.Gender);
It would be great if the filter automatically adjusts when more properties are added to the searchObject.