Reputation: 7743
I am currently using the jQuery
$.grep()
method to filter an array by a value passed to the method like so:
var filteredArray = $.grep(arr, function (n, i) {
return (n.type === type);
}, true);
So the array is an array of objects that have a type property and if that property is equal to the type passed to it then filter out the other objects and produce a new array from the result.
How do i extend this to accept multiple types of filters?
So if i pass an array of filters that can be a minimum length of 1 and nay maximum.
Upvotes: 1
Views: 2025