Files: 59686225be4be560357b42396b8ff5f68b049505 / app / reducer.js
660 bytesRaw
1 | const bulk = require('bulk-require') |
2 | import { combineReducers } from 'redux' |
3 | import { routeReducer } from 'redux-simple-router' |
4 | import { map, mapValues, assign, camelCase, mapKeys } from 'lodash' |
5 | |
6 | export default combine(assign( |
7 | mapValues( |
8 | bulk(__dirname, '*/reducer.js'), |
9 | (module) => module.reducer.default |
10 | ), |
11 | mapValues( |
12 | bulk(__dirname, '*/reducers/*.js'), |
13 | (module) => combine( |
14 | mapValues( |
15 | module.reducers, |
16 | m => m.default |
17 | ) |
18 | ) |
19 | ), |
20 | { |
21 | routing: routeReducer |
22 | } |
23 | )) |
24 | |
25 | function combine (reducers) { |
26 | return combineReducers( |
27 | mapKeys( |
28 | reducers, |
29 | (reducer, name) => camelCase(name) |
30 | ) |
31 | ) |
32 | } |
33 |
Built with git-ssb-web