All files / lib buildReducer.js

100% Statements 5/5
100% Branches 3/3
100% Functions 2/2
100% Lines 4/4
1 2 3 4 5 6 7 8  6x 45x 45x 42x      
export function buildReducer(initialState, handlers) {
  return (state = initialState, action) => {
    const handler = handlers[action.type]
    if (!handler) return state
    return handler(state, action)
  }
}