checkStore.js 458 Bytes
Newer Older
Julien Benchetrit's avatar
Julien Benchetrit committed
1
import invariant from 'invariant';
dengxiaofeng's avatar
dengxiaofeng committed
2
import { conformsTo, isFunction, isObject } from 'lodash';
Julien Benchetrit's avatar
Julien Benchetrit committed
3 4 5 6 7 8 9 10 11 12 13

export default function checkStore(store) {
  const shape = {
    dispatch: isFunction,
    subscribe: isFunction,
    getState: isFunction,
    replaceReducer: isFunction,
    runSaga: isFunction,
    injectedReducers: isObject,
    injectedSagas: isObject,
  };
14
  invariant(conformsTo(store, shape), '(src/utils...) injectors: Expected a valid redux store');
Julien Benchetrit's avatar
Julien Benchetrit committed
15
}