Skip to content

Commit 344b8d1

Browse files
committed
Merge pull request #21 from dbrans/patch-1
Can use map instead of reduce here.
2 parents d2059d3 + 626ad16 commit 344b8d1

File tree

1 file changed

+3
-4
lines changed

1 file changed

+3
-4
lines changed

src/handleActions.js

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -2,10 +2,9 @@ import handleAction from './handleAction';
22
import reduceReducers from 'reduce-reducers';
33

44
export default function handleActions(handlers, defaultState) {
5-
const reducers = Object.keys(handlers).reduce((result, type) => {
6-
result.push(handleAction(type, handlers[type]));
7-
return result;
8-
}, []);
5+
const reducers = Object.keys(handlers).map(type => {
6+
return handleAction(type, handlers[type]);
7+
});
98

109
return typeof defaultState !== 'undefined'
1110
? (state = defaultState, action) => reduceReducers(...reducers)(state, action)

0 commit comments

Comments
 (0)