/**
 * Lodash是一个一致性、模块化、高性能的JavaScript实用工具库。
 * 它提供了一套函数式编程的实用功能，通过降低array、number、objects、string等的使用难度从而让JavaScript变得更简单。
 * 其中部分是目前ECMAScript尚未制定的规范，但被业界认可。
 *
 * Invariant是一个用于检查JavaScript代码中的不变量的库。
 * 它可以帮助你确保你的代码中的某些条件始终为真，从而提高代码的可靠性和可维护性。
 */

import invariant from 'invariant';
import conformsTo from 'lodash/conformsTo';
import isFunction from 'lodash/isFunction';
import isObject from 'lodash/isObject';

/**
 * Validates the redux store is set up properly to work with this library.
 */
export default function checkStore(store) {
  const shape = {
    dispatch: isFunction,
    subscribe: isFunction,
    getState: isFunction,
    replaceReducer: isFunction,
    createReducer: isFunction,
    injectedReducers: isObject,
  };
  invariant(
    conformsTo(store, shape),
    '(redux-injectors...) checkStore: Expected a redux store that has been configured for use with redux-injectors.',
  );
}
