Currently, I have an array of objects that I need to filter based on user input. For example, if a user enters "Red Shirt," I want to only return entries with values like
{color: "red", clothingType: "shirt"}
rather than
{color: "red", clothingType: "scarf"}
// or
{color: "blue", clothingType: "shirt"}
I am hoping to create a generic solution that can be easily adapted for other scenarios, such as searching for "John Smith" in objects like
{firstName:"John", lastName:"Smith"},
Is there a straightforward way to implement this overall filter without requiring the user to specify color and clothing type separately, or is that impossible?
Currently, my approach involves retrieving the value of "data[key]" and using "includes" to check if "red" or "shirt" exist in the object individually. However, I am unsure how to search for multiple values simultaneously.