Commit 2528e217 authored by Gilad Peleg's avatar Gilad Peleg

reduce redundant filter & without syntax

parent 81d044dc
......@@ -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