|
1 | 1 | import Immutable from 'immutable'; |
2 | 2 | import { |
3 | | - getUnexpectedInvocationParameterMessage, |
4 | | - validateNextState |
| 3 | + getUnexpectedInvocationParameterMessage, |
| 4 | + validateNextState |
5 | 5 | } from './utilities'; |
6 | 6 |
|
7 | 7 | export default (reducers: Object): Function => { |
8 | 8 | const reducerKeys = Object.keys(reducers); |
9 | 9 |
|
10 | | - // eslint-disable-next-line space-infix-ops |
| 10 | + // eslint-disable-next-line space-infix-ops |
11 | 11 | return (inputState: ?Immutable.Map = Immutable.Map(), action: Object): Immutable.Map => { |
12 | | - // eslint-disable-next-line no-process-env |
| 12 | + // eslint-disable-next-line no-process-env |
13 | 13 | if (process.env.NODE_ENV !== 'production') { |
14 | 14 | const warningMessage = getUnexpectedInvocationParameterMessage(inputState, reducers, action); |
15 | 15 |
|
16 | 16 | if (warningMessage) { |
17 | | - // eslint-disable-next-line no-console |
| 17 | + // eslint-disable-next-line no-console |
18 | 18 | console.error(warningMessage); |
19 | 19 | } |
20 | 20 | } |
21 | 21 |
|
22 | 22 | return inputState |
23 | | - .withMutations((temporaryState) => { |
24 | | - reducerKeys.forEach((reducerName) => { |
25 | | - const reducer = reducers[reducerName]; |
26 | | - const currentDomainState = temporaryState.get(reducerName); |
27 | | - const nextDomainState = reducer(currentDomainState, action); |
| 23 | + .withMutations((temporaryState) => { |
| 24 | + reducerKeys.forEach((reducerName) => { |
| 25 | + const reducer = reducers[reducerName]; |
| 26 | + const currentDomainState = temporaryState.get(reducerName); |
| 27 | + const nextDomainState = reducer(currentDomainState, action); |
28 | 28 |
|
29 | | - validateNextState(nextDomainState, reducerName, action); |
| 29 | + validateNextState(nextDomainState, reducerName, action); |
30 | 30 |
|
31 | | - temporaryState.set(reducerName, nextDomainState); |
32 | | - }); |
33 | | - }); |
| 31 | + temporaryState.set(reducerName, nextDomainState); |
| 32 | + }); |
| 33 | + }); |
34 | 34 | }; |
35 | 35 | }; |
0 commit comments