| 21274 | } |
| 21275 | |
| 21276 | function assertReducerShape(reducers) { |
| 21277 | Object.keys(reducers).forEach(function (key) { |
| 21278 | var reducer = reducers[key]; |
| 21279 | var initialState = reducer(undefined, { type: _createStore.ActionTypes.INIT }); |
| 21280 | |
| 21281 | if (typeof initialState === 'undefined') { |
| 21282 | throw new Error('Reducer "' + key + '" returned undefined during initialization. ' + 'If the state passed to the reducer is undefined, you must ' + 'explicitly return the initial state. The initial state may ' + 'not be undefined. If you don\'t want to set a value for this reducer, ' + 'you can use null instead of undefined.'); |
| 21283 | } |
| 21284 | |
| 21285 | var type = '@@redux/PROBE_UNKNOWN_ACTION_' + Math.random().toString(36).substring(7).split('').join('.'); |
| 21286 | if (typeof reducer(undefined, { type: type }) === 'undefined') { |
| 21287 | throw new Error('Reducer "' + key + '" returned undefined when probed with a random type. ' + ('Don\'t try to handle ' + _createStore.ActionTypes.INIT + ' or other actions in "redux/*" ') + 'namespace. They are considered private. Instead, you must return the ' + 'current state for any unknown actions, unless it is undefined, ' + 'in which case you must return the initial state, regardless of the ' + 'action type. The initial state may not be undefined, but can be null.'); |
| 21288 | } |
| 21289 | }); |
| 21290 | } |
| 21291 | |
| 21292 | /** |
| 21293 | * Turns an object whose values are different reducer functions, into a single |