Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
function createReduxStore( key, options, registry ) {
const middlewares = [
createResolversCacheMiddleware( registry, key ),
promise,
];
if ( options.controls ) {
const normalizedControls = mapValues( options.controls, ( control ) => {
return control.isRegistryControl ? control( registry ) : control;
} );
middlewares.push( createReduxRoutineMiddleware( normalizedControls ) );
}
const enhancers = [
applyMiddleware( ...middlewares ),
];
if ( typeof window !== 'undefined' && window.__REDUX_DEVTOOLS_EXTENSION__ ) {
enhancers.push( window.__REDUX_DEVTOOLS_EXTENSION__( { name: key, instanceId: key } ) );
}
const { reducer, initialState } = options;
const enhancedReducer = combineReducers( {
metadata: metadataReducer,
root: reducer,
} );
return createStore(