docs(todo app): replace remaining tasks reduce func with filter.length

closes #1050
This commit is contained in:
Samuli Ulmanen 2016-04-06 09:10:52 +03:00 committed by Ward Bell
parent 2b714a3945
commit 9370113b9d
1 changed files with 9 additions and 9 deletions

View File

@ -23,14 +23,14 @@ export class TodoApp {
];
get remaining() {
return this.todos.reduce((count: number, todo: Todo) => count + +!todo.done, 0);
return this.todos.filter(todo => !todo.done).length;
}
archive(): void {
var oldTodos = this.todos;
let oldTodos = this.todos;
this.todos = [];
oldTodos.forEach((todo: Todo) => {
if (!todo.done) this.todos.push(todo);
oldTodos.forEach(todo => {
if (!todo.done) { this.todos.push(todo); }
});
}