backbone.projections v1.0.0
backbone.projections is a set of projections for Backbone.Collection
CappedCollection project underlying collection into a read-only collection of capped size
{CappedCollection} = require 'backbone.projections' collection = new Collection [...] capped = new CappedCollection(collection, cap: 5)this way
cappedwill contain no more than 5 models and will behave as a Backbone.Collection and will be in sync with underlyingcollection. CappedCollection supportscomparatorbut if no comparator is provided thencappedwill have an order induced by underlying collection.FilteredCollection project underlying collection into a read-only collection of models which match some predicate
{FilteredCollection} = require 'backbone.projections' collection = new Collection [...] filtered = new FilteredCollection collection, filter: (model) -> model.get('date').isToday()this way
filteredwill contain only models which have "today's date" and will behave as a Backbone.Collection and will be in sync with underlyingcollection. FilteredCollection supportscomparatorbut if no comparator is provided thencappedwill have an order induced by underlying collection.