Socket
Socket
Sign inDemoInstall

action-typex

Package Overview
Dependencies
0
Maintainers
1
Versions
1
Alerts
File Explorer

Advanced tools

Install Socket

Detect and block malicious and high-risk dependencies

Install

    action-typex

The flux action types generator


Version published
Maintainers
1
Install size
7.26 kB
Created

Readme

Source

Action Typex

ActionTypes is a library which helps you generate action types in your flux architecture. It contains high-order functions and functions which get your arguments and return an object with required values which contain action types into your project.

Example

// 1. Import all functions from NPM package
// P.S. Here is a CommonJS, but using with bundler you can use `import`
const {
  initialConfig,
  configureActionTypes,
  createActionTypesGroup,
  combineActionTypes,
  createStaticActions
} =  require('../');

// 2. Generate some function for generating your action types series using configureActionTypes()
// You can use initialConfig or your own config as object {postfix, separator}
const asyncThunkActionTypes = configureActionTypes(initialConfig);

// 3. createActionTypesGroup returns another function using HOF you get from configure,
// and you can set arguments for getting action types you need
createActionTypesGroup(asyncThunkActionTypes)('MAKE_PAYMENT', 'GET_TOKEN'),

// 4. createStaticActions returns an object with `key = value` using every argument
createStaticActions('SET_VISANILITY', 'GET_NAME')

// 5. And combineActionTypes helps you to combine all your generations into one object for export
combineActionTypes(
  createActionTypesGroup(asyncThunkActionTypes)('MAKE_PAYMENT', 'GET_TOKEN'),
  createStaticActions('SET_VISANILITY', 'GET_NAME') 
)
// combineActionTypes => {
//    MAKE_PAYMENT_SUCCESS: 'MAKE_PAYMENT/SUCCESS',
//    MAKE_PAYMENT_ERROR: 'MAKE_PAYMENT/ERROR',
//    MAKE_PAYMENT_LOADING: 'MAKE_PAYMENT/LOADING',
//    GET_TOKEN_SUCCESS: 'GET_TOKEN/SUCCESS',
//    GET_TOKEN_ERROR: 'GET_TOKEN/ERROR',
//    GET_TOKEN_LOADING: 'GET_TOKEN/LOADING',
//    SET_VISANILITY: 'SET_VISANILITY',
//    GET_NAME: 'GET_NAME'
// }

Keywords

FAQs

Last updated on 13 Jul 2019

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