create-store
Create a redux store from an object of action handling functions, keyed
by the actions they handle. Has createStore.compose(fns)
helper function
to combine multiple action handlers into a single action.
Big thanks to dlmanning, our conversations lead me here.
var createStore = require('create-store')
var handlers =
{ add: add
, multiply: multiply
, addThenMultiply: createStore.compose(add, multiply)
}
var store = createStore(handlers)
function add (store, action) {
store.num += action.num
return store
}
function multiply (store, action) {
store.num *= action.num
return store
}