Skip to content

Commit

Permalink
style: fix style issues
Browse files Browse the repository at this point in the history
  • Loading branch information
gajus committed Jan 11, 2017
1 parent 0057fac commit b0ed54c
Show file tree
Hide file tree
Showing 3 changed files with 15 additions and 17 deletions.
28 changes: 14 additions & 14 deletions src/combineReducers.js
Original file line number Diff line number Diff line change
@@ -1,35 +1,35 @@
import Immutable from 'immutable';
import {
getUnexpectedInvocationParameterMessage,
validateNextState
getUnexpectedInvocationParameterMessage,
validateNextState
} from './utilities';

export default (reducers: Object): Function => {
const reducerKeys = Object.keys(reducers);

// eslint-disable-next-line space-infix-ops
// eslint-disable-next-line space-infix-ops
return (inputState: ?Immutable.Map = Immutable.Map(), action: Object): Immutable.Map => {
// eslint-disable-next-line no-process-env
// eslint-disable-next-line no-process-env
if (process.env.NODE_ENV !== 'production') {
const warningMessage = getUnexpectedInvocationParameterMessage(inputState, reducers, action);

if (warningMessage) {
// eslint-disable-next-line no-console
// eslint-disable-next-line no-console
console.error(warningMessage);
}
}

return inputState
.withMutations((temporaryState) => {
reducerKeys.forEach((reducerName) => {
const reducer = reducers[reducerName];
const currentDomainState = temporaryState.get(reducerName);
const nextDomainState = reducer(currentDomainState, action);
.withMutations((temporaryState) => {
reducerKeys.forEach((reducerName) => {
const reducer = reducers[reducerName];
const currentDomainState = temporaryState.get(reducerName);
const nextDomainState = reducer(currentDomainState, action);

validateNextState(nextDomainState, reducerName, action);
validateNextState(nextDomainState, reducerName, action);

temporaryState.set(reducerName, nextDomainState);
});
});
temporaryState.set(reducerName, nextDomainState);
});
});
};
};
2 changes: 0 additions & 2 deletions src/utilities/getUnexpectedInvocationParameterMessage.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,3 @@
/* eslint-disable lodash3/prefer-lodash-method */

import Immutable from 'immutable';
import getStateName from './getStateName';

Expand Down
2 changes: 1 addition & 1 deletion src/utilities/validateNextState.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
export default (nextState, reducerName: string, action: Object): null => {
// eslint-disable-next-line no-undefined
// eslint-disable-next-line no-undefined
if (nextState === undefined) {
throw new Error('Reducer "' + reducerName + '" returned undefined when handling "' + action.type + '" action. To ignore an action, you must explicitly return the previous state.');
}
Expand Down

0 comments on commit b0ed54c

Please sign in to comment.