jmorrell / backbone.obscura

A read-only proxy of a Backbone.Collection that can be filtered, sorted, and paginated.
http://jmorrell.github.io/backbone.obscura/
MIT License
107 stars 19 forks source link

filterBy Array #3

Closed mulderp closed 11 years ago

mulderp commented 11 years ago

It would be nice to have some filter by Array function:

movies.filterBy('ratings', [3,4,5]);

Then, all movies that have a rating of 3 OR 4 OR 5, should be returned. It looks a bit familar to

filtered.filterBy('foo and bar filter', { foo: 2, bar: 3 }) 

but with an Array.

What do you think? I can try a PR for this.

Cheers.

mulderp commented 11 years ago

This is possible already:

 filtered.filterBy('Array', {b: function(val) { return _.contains([1,4], val); }});