,
var MyCollection = Backbone.Collection.extend ({
filtered : function () {
UnderScore, true valid false true, true - , . this.models, , model.get(''), ,
var results = _.filter( this.models, function ( model ) {
if ( model.get('foo') == 'bar' )
return true ;
return false ;
});
, JSON, , , .
results = _.map( results, function( model ) { return model.toJSON() } );
, ,
return new Backbone.Collection( results ) ;