backbone.filterwhere

0.0.4 • Public • Published

Backbone.filterWhere

Backbone.filterWhere adds a new method to Backbone.Collections.

Backbone.Collections#filterWhere acts like Backbone.Collections#where expect it returns a new collection that is constantely synced to the original collection it was filtered from.

build status browser support

Example

var things = new Backbone.Collection([{
  name: "Fry",
  species: "Human"
}, {
  name: "Bender",
  species: "Robot"
}, {
  name: "Clamps",
  species: "Robot"
}]);

var humans = things.filterWhere({species: "Human"});
var robots = things.filterWhere({species: "Robot"});

console.log("Current humans: " + humans.length);
console.log("Current robots: " + robots.length);

things.add([ { name: "Lela", species: "Human" } ]);

console.log("Current humans: " + humans.length);
console.log("Current robots: " + robots.length);

Readme

Keywords

none

Package Sidebar

Install

npm i backbone.filterwhere

Weekly Downloads

3

Version

0.0.4

License

BSD

Last publish

Collaborators

  • morganrallen