Skip to content

Latest commit

 

History

History
33 lines (22 loc) · 1019 Bytes

README.md

File metadata and controls

33 lines (22 loc) · 1019 Bytes

Redux Ensure Flux Standard Action Middleware

redux-ensure-fsa provides a middleware function to use as part of the redux dispatch chain. It is intended for use in development only to check that all actions at the end of the chain follow the Flux Standard Action protocol.

Installation

npm install @meadow/redux-ensure-fsa

Usage

import { createStore, applyMiddleware } from 'redux';
import ensureFSAMiddleware from '@meadow/redux-ensure-fsa';
import thunkMiddleware from 'redux-thunk';

let middleware = [thunkMiddleware];

if (process.env.NODE_ENV !== 'production') {
  const fsaMiddleware = ensureFSAMiddleware({
    ignore: function (action) {
      return false;
    }
  })

  middleware = [...middleware, fsaMiddleware];
}

const createStoreWithMiddleware = applyMiddleware(...middleware)(createStore);

ghit.me