(state: QuestionBodyState, answer: string)
| 193 | } |
| 194 | |
| 195 | function questionToggle(state: QuestionBodyState, answer: string): QuestionBodyState { |
| 196 | const list = [...(state.answers[state.tab] ?? [])] |
| 197 | const idx = list.indexOf(answer) |
| 198 | if (idx === -1) { |
| 199 | list.push(answer) |
| 200 | } else { |
| 201 | list.splice(idx, 1) |
| 202 | } |
| 203 | |
| 204 | return storeAnswers(state, state.tab, list) |
| 205 | } |
| 206 | |
| 207 | export function questionMove(state: QuestionBodyState, request: QuestionRequest, dir: -1 | 1): QuestionBodyState { |
| 208 | const total = questionTotal(request, state) |
no test coverage detected