js/libs/ember-data.js
function(type, query, filter) {
    var promise;

    // allow an optional server query
    if (arguments.length === 3) {
      promise = this.findQuery(type, query);
    } else if (arguments.length === 2) {
      filter = query;
    }

    type = this.modelFor(type);

    var array = this.recordArrayManager
      .createFilteredRecordArray(type, filter);
    promise = promise || resolve(array);

    return promiseArray(promise.then(function() {
      return array;
    }, null, "DS: Store#filter of " + type));
  }
function(type, query, filter) {
    var promise;

    // allow an optional server query
    if (arguments.length === 3) {
      promise = this.findQuery(type, query);
    } else if (arguments.length === 2) {
      filter = query;
    }

    type = this.modelFor(type);

    var array = this.recordArrayManager
      .createFilteredRecordArray(type, filter);
    promise = promise || resolve(array);

    return promiseArray(promise.then(function() {
      return array;
    }, null, "DS: Store#filter of " + type));
  }
Takes a type and filter function, and returns a live RecordArray that
remains up to date as new records are loaded into the store or created
locally.

The callback function takes a materialized record, and returns true
if the record should be included in the filter and false if it should
not.

The filter function is called once on all records for the type when
it is created, and then once on each newly loaded or created record.

If any of a record's properties change, or if it changes state, the
filter function will be invoked again to determine whether it should
still be in the array.

Optionally you can pass a query which will be triggered at first. The
results returned by the server could then appear in the filter if they
match the filter function.

Example

```javascript
store.filter(App.Post, {unread: true}, function(post) {
return post.get('unread');
}).then(function(unreadPosts) {
unreadPosts.get('length'); // 5
var unreadPost = unreadPosts.objectAt(0);
unreadPosts.set('unread', false);
unreadPosts.get('length'); // 4
});
```

@method filter
@param {String or subclass of DS.Model} type
@param {Object} query optional query
@param {Function} filter
@return {DS.PromiseArray}