pluck は をラップする便利なメソッドでmap
ありmap
、コレクションで直接利用できるため、これが容易になります。
モデルから属性を取得しようとしていると仮定するとdate
、次のことができます。
days = this.collection.map(function(model){
return model.get('date');
});
filter
select 呼び出しは、メソッドとしてコレクションでも直接利用できます。
days = this.collection.filter(function(model){
return model.attributes.type === 'session';
});
これら 2 つを連鎖させることもできますが、メソッドを個別に定義すると役立ちます。
var sessionFilter = function(model){
return model.attributes.type === 'session';
};
var getDate = function(model){ return model.get('date'); }
days = this.collection.filter(sessionFilter).map(getDate);
これはあなたが探している結果を返すはずです...または少なくともこれに近いもの:)