jashkenas/backbone — pull request #2665 by lloydwatkin (2013-07-10 09:40:21+00:00)
Title: Allow filtering of incoming data

Hi,

I'd like to be able to filter incoming data to a collection before display. There doesn't seem to be any functionality to allow me to do this easily, so I've patched backbone to allow me to do this. My collection now has the following additional method:

```javascript
var Feed = Backbone.Collection.extend({

...

filter: function(model) {
var node = model.get('node')
return (node.substr(-6) == '/posts')
}
})
```

This isn't a full pull request (i.e. no tests) as I wanted to gauge whether there was actually a way to do this (I can't find any) and whether there is a good reason there isn't something like this in place already.

If its given the thumbs up then I'll throw in some UTs and then push into this PR to be added.

Thanks, Lloyd.