Socket
Socket
Sign inDemoInstall

redux-validate-fsa

Package Overview
Dependencies
6
Maintainers
1
Versions
3
Alerts
File Explorer

Advanced tools

Install Socket

Detect and block malicious and high-risk dependencies

Install

    redux-validate-fsa

Redux middleware that validates if an action is a Flux Standard Action (FSA)


Version published
Weekly downloads
213
decreased by-8.19%
Maintainers
1
Install size
44.0 kB
Created
Weekly downloads
 

Readme

Source

redux-validate-fsa

NPM

Build Status

Redux middleware that validates if an action is a Flux Standard Action (FSA).

Usage

const middleware = [reduxThunk]
if (__DEV__) {
  const fsaMiddleware = require('redux-validate-fsa')(ignore /* optional */)
  middleware.push(fsaMiddleware)
}

The ignore argument is for you to filter actions that should be skipped from the FSA check. This is useful if you have to deal with non-compliant actions from third-party libraries.

  • If an array is given, it must be the array of action types that should be skipped from the FSA check.
  • If a function is given, it must return true for action that should be skipped from the FSA check.

For example, if you use redux-simple-router, you should ignore the path-update actions, which are not FSA compliant.

import {UPDATE_PATH} from 'redux-simple-router'
const fsaMiddleware = require('redux-validate-fsa')([UPDATE_PATH])

Notes:

  • This middleware is only useful in dev mode. So it should be included conditionally.
  • If you use redux-thunk, make sure the thunk middleware is added before this middleware. Alternatively, you can use the ignore predicate to filter out actions that are thunks.

Test

npm install
npm test

Keywords

FAQs

Last updated on 22 Nov 2015

Did you know?

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc