Files
habitica/common/script/ops/clearCompleted.js
2016-04-04 17:18:42 +02:00

11 lines
308 B
JavaScript

import _ from 'lodash';
// TODO move to client since it's only used there?
// TODO rename file to clearCompletedTodos
module.exports = function clearCompletedTodos (todos) {
_.remove(todos, todo => {
return todo.completed && (!todo.challenge || !todo.challenge.id || todo.challenge.broken);
});
};