Total Complexity | 3 |
Complexity/F | 1 |
Lines of Code | 18 |
Function Count | 3 |
Duplicated Lines | 0 |
Ratio | 0 % |
Changes | 0 |
1 | import { uid } from 'uid' |
||
2 | |||
3 | type TTodos = { |
||
4 | todos: { id: string; name: string; done: boolean }[] |
||
5 | } |
||
6 | |||
7 | export default { |
||
8 | addTodo(state: TTodos, payload: string) { |
||
9 | state.todos.push({ id: uid(), name: payload, done: false }) |
||
10 | }, |
||
11 | toggleDone(state: TTodos, index: number) { |
||
12 | state.todos[index].done = !state.todos[index].done |
||
13 | }, |
||
14 | deleteTodo(state: TTodos, index: number) { |
||
15 | state.todos.splice(index, 1) |
||
16 | }, |
||
17 | } |
||
18 |