npm.io
0.2.0 • Published 8 years ago

swop

Licence
MIT
Version
0.2.0
Deps
0
Size
4 kB
Vulns
0
Weekly
0

I will add more, but just as a quick usage example.

Assume you have actions ADD_TO_DO, REMOVE_TO_DO, and reducers addToDo and removeToDo.

Then…

import swop from 'swop';

// constants and reducers are defined here.

// Export a higher-order reducer that switches to the reducer that the action maps to 
// or defaults to an identity reducer if there’s not matching action.
export default swop({
  [ADD_TO_DO]: addToDo,
  [REMOVE_TO_DO]: removeToDo
});

Keywords