(key: Key, toIndex: number)
| 323 | }); |
| 324 | }, |
| 325 | move(key: Key, toIndex: number) { |
| 326 | dispatch(state => { |
| 327 | let index = state.items.findIndex(item => getKey!(item) === key); |
| 328 | if (index === -1) { |
| 329 | return state; |
| 330 | } |
| 331 | |
| 332 | let copy = state.items.slice(); |
| 333 | let [item] = copy.splice(index, 1); |
| 334 | copy.splice(toIndex, 0, item); |
| 335 | return { |
| 336 | ...state, |
| 337 | items: copy |
| 338 | }; |
| 339 | }); |
| 340 | }, |
| 341 | moveBefore(key: Key, keys: Iterable<Key>) { |
| 342 | dispatch(state => { |
| 343 | let toIndex = state.items.findIndex(item => getKey!(item) === key); |
no test coverage detected