Reputation: 21
I am trying to filter two-dimensional array like var arr = [ [object, object], [object, object], [object, object] ] and return the same structure. Any ideas?
Upvotes: 1
Views: 1219
Reputation: 664444
A combination of filter
and map
will do it:
_.map(arr, function(subarr) {
return _.filter(subarr, itemcondition)
})
// or:
_.map(arr, _.partial(_.filter, _, itemcondition));
Upvotes: 1