diff options
Diffstat (limited to 'front/odiparpack/app/utils/checkStore.js')
| -rw-r--r-- | front/odiparpack/app/utils/checkStore.js | 21 |
1 files changed, 21 insertions, 0 deletions
diff --git a/front/odiparpack/app/utils/checkStore.js b/front/odiparpack/app/utils/checkStore.js new file mode 100644 index 0000000..610ea0f --- /dev/null +++ b/front/odiparpack/app/utils/checkStore.js @@ -0,0 +1,21 @@ +import { conformsTo, isFunction, isObject } from 'lodash'; +import invariant from 'invariant'; + +/** + * Validate the shape of redux store + */ +export default function checkStore(store) { + const shape = { + dispatch: isFunction, + subscribe: isFunction, + getState: isFunction, + replaceReducer: isFunction, + runSaga: isFunction, + injectedReducers: isObject, + injectedSagas: isObject, + }; + invariant( + conformsTo(store, shape), + '(app/utils...) injectors: Expected a valid redux store', + ); +} |
