So I'm trying to do a search function that searches the whole object inside and its values, until now I have this function that searches only first layer of object but not the ones that are inside, and the other problem is that doesn't searches all the item when its with lower/upper case, I want a way to search all 'Books' even if the search is just 'book', here is my js:
const findIn = (arr, query) => {
return arr.filter((obj) =>
Object.keys(obj).some((key) => {
if (typeof obj[key] === 'string') return obj[key].includes(query);
})
);
};