Commit cf5d2f12 authored by Sindre Sorhus's avatar Sindre Sorhus

Merge pull request #938 from pgilad/patch-4

reduce redundant filter & without syntax
parents 27bdc595 2528e217
......@@ -7,21 +7,17 @@ define([
], function (Backbone, Todo) {
'use strict';
function isCompleted(todo) {
return todo.get('completed');
}
return Backbone.Collection.extend({
model: Todo,
localStorage: new Backbone.LocalStorage('todos-backbone'),
getCompleted: function () {
return this.filter(isCompleted);
return this.where({completed:true});
},
getActive: function () {
return this.reject(isCompleted);
return this.where({completed:false});
},
comparator: function (todo) {
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment