Press n or j to go to the next uncovered block, b, p or k for the previous block.
| 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 | 3x 2x 1x 1x 1x 9x 3x 6x 7x 7x 6x 1x 1x |
const squash = key => update => (state, event) => {
if (event.type !== key) {
return state
}
return update(state, event.payload)
}
const compress = updates => {
if (typeof updates === 'string') {
return squash(updates)
}
return (state, event, signal) => {
let update = updates[event.type]
if (update) {
return update(state, event.payload, signal)
}
return state
}
}
export default compress
|