🚀 Big News: Socket Acquires Coana to Bring Reachability Analysis to Every Appsec Team.Learn more
Socket
Book a DemoInstallSign in
Socket

action-typex

Package Overview
Dependencies
Maintainers
1
Versions
1
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

action-typex

The flux action types generator

1.0.0
latest
Source
npm
Version published
Weekly downloads
2
Maintainers
1
Weekly downloads
 
Created
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

flux

FAQs

Package last updated on 13 Jul 2019

Did you know?

Socket

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