docs(todo app): replace remaining tasks reduce func with filter.length
closes #1050
This commit is contained in:
parent
2b714a3945
commit
9370113b9d
|
@ -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); }
|
||||
});
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in New Issue