Anton Shestakov <av6@dwimlabs.net>, Sun, 26 Jun 2016 15:30:33 +0800
tests: move some test to another, more appropriate, section
Too many methods that allow searching/filtering were put into "basic" category.
Backbone.Shard is a variation on a Subset taken from different perspective.
Shard was built as a simple "persistent filter" for collections; it can help
grouping and displaying items of a certain kind based on your filter function.
Shard shares with Backbone.Collection most of the methods listed in
**Underscore methods** section of the
[
Backbone documentation](
http://backbonejs.org/#Collection-Underscore-Methods):
var shelf = Backbone.Shard({
filter: function(book) { return book.get('read'); }
You can add/remove models or reset
*the original collection* and Shard will
honestly try to keep up with it, but currently Shard itself has no methods such
Events work and respect your filter function:
shelf.on('add', doSomething);
collection.add({read: true}); // this will call doSomething
collection.add({read: false}); // this won't
Tests can be run [
here](
https://demos.dwimlabs.net/backbone-shard/test/) or you
[
source](
https://bitbucket.org/av6/backbone-shard/get/tip.tar.bz2) and open
test/index.html in your browser.