I have an object like so:
> Object
> Rett@site.com: Array[100]
> pel4@gmail.com: Array[4]
> 0
id : 132
selected : true
> 1
id : 51
selected : false
etc..
How can I use the underscore _.filter() to return back only the items where selected === true?
I’ve never had the need to go down to layers with _.filter(). Something like
var stuff = _.filter(me.collections, function(item) {
return item[0].selected === true;
});
Thank you
If you want to pull all array elements from any e-mail address where
selectedistrue, you can iterate like so:If you only want to pull the arrays where all elements are
selected, you might instead do something like this: