billysbilling/billy-data — pull request #28 by sebastianseilund (2014-03-04 03:00:07+00:00)
Title: Added support for custom filters

Works both on filtered record arrays (with local data) and with the fixture adapter.

Usage:

```javascript
App.Invoice.registerFilter(name, dependencies, callback);
```

Where `name` is the name of the filter, i.e. what the key name in the `query` object should be. `dependencies` is an array of property names that the filter uses. And `callback` is a function that takes the record's data, the value of `name` in the `query` object, and finally the `query` object itself.

Example:

```javascript
App.Invoice.registerFilter('minEntryDate', ['entryDate'], function(data, minEntryDate, query) {
minEntryDate === query.minEntryDate; //true
return moment(Em.get(data, 'entryDate')).isAfter(minEntryDate);
});

App.Invoice.filter({
query: {
minEntryDate: '2014-03-02'
}
});
}
```