Issues (4)

src/redux-reducer-map.js (2 issues)

1
const defaultOnUnknownActionTypeHandler = (state, action) => {
0 ignored issues
show
The constant defaultOnUnknownActionTypeHandler seems to be never used. Consider removing it.
Loading history...
2
  const error = new Error('Unknown action type ' + action.type)
3
  error.state = state
4
  error.action = action
5
  throw error
6
}
7
8
const createReducerViaMap = (map, initial, onUnknownActionType = defaultOnUnknownActionTypeHandler) =>
9
  (state, action) => {
10
    if (typeof state === 'undefined') {
11
      return initial
12
    } else if (map.hasOwnProperty(action.type)) {
13
      return map[action.type](state, action)
14
    } else if (action.type === '@@redux/INIT') {
15
      return initial
16
    } else {
17
      return onUnknownActionType(state, action)
18
    }
19
  }
20
21
createReducerViaMap.justReturnState = (state, action) => state
0 ignored issues
show
The parameter action is not used and could be removed.

This check looks for parameters in functions that are not used in the function body and are not followed by other parameters which are used inside the function.

Loading history...
22
23
export default createReducerViaMap
24