store/mutations.ts   A
last analyzed

Complexity

Total Complexity 3
Complexity/F 1

Size

Lines of Code 18
Function Count 3

Duplication

Duplicated Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
wmc 3
eloc 12
mnd 0
bc 0
fnc 3
dl 0
loc 18
bpm 0
cpm 1
noi 0
c 0
b 0
f 0
rs 10

3 Functions

Rating   Name   Duplication   Size   Complexity  
A mutations.ts ➔ deleteTodo 0 2 1
A mutations.ts ➔ toggleDone 0 2 1
A mutations.ts ➔ addTodo 0 2 1
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