Gathering detailed insights and metrics for action-reducer
Gathering detailed insights and metrics for action-reducer
Gathering detailed insights and metrics for action-reducer
Gathering detailed insights and metrics for action-reducer
redux-no-reducer-helper
a helper to write redux action and reducer faster
redux-act
An opinionated lib to create actions and reducers for Redux
redux-batched-actions
redux higher order reducer + action creator to reduce actions under a single subscriber notification
redux-thunk-action-reducer
Redux Action Reducer with redux thunk
A simple ActionCreator and Reducer library that provides type-safe for TypeScript.
npm install action-reducer
Typescript
Module System
Node Version
NPM Version
69
Supply Chain
98.2
Quality
75.6
Maintenance
100
Vulnerability
100
License
TypeScript (96.88%)
JavaScript (3.12%)
Total Downloads
17,323
Last Day
21
Last Week
76
Last Month
438
Last Year
4,738
MIT License
4 Stars
66 Commits
3 Branches
1 Contributors
Updated on Oct 09, 2022
Minified
Minified + Gzipped
Latest Version
0.4.0
Package Id
action-reducer@0.4.0
Unpacked Size
9.78 kB
Size
3.25 kB
File Count
8
NPM Version
8.17.0
Node Version
16.15.0
Cumulative downloads
Total Downloads
Last Day
0%
21
Compared to previous day
Last Week
33.3%
76
Compared to previous week
Last Month
-36.2%
438
Compared to previous month
Last Year
6.3%
4,738
Compared to previous year
A simple ActionCreator and Reducer library that provides type-safe for TypeScript.
Used for React (useReducer
), Redux, etc.
npm install action-reducer
1import ActionReducer from 'action-reducer' 2// OR 3// const ActionReducer = require('action-reducer').default 4 5const initState = { flag: false } 6const { createAction, reducer } = ActionReducer(initState) 7 8export const toggleFlag = createAction( 9 'TOGGLE_FLAG', // action type (Optional arg) 10 (state) => // Reducer for this action 11 ({ ...state, flag: !state.flag }) 12) 13 14export const setFlag = createAction( 15 'SET_FLAG', 16 (state, arg1, /* arg2, arg3... */) => 17 ({ ...state, flag: arg1 }) 18) 19 20// reducer can be used as Redux Reducer!! 21export default reducer 22 23setFlag.type // 'SET_FLAG' 24setFlag(true) // { type: 'SET_FLAG', payload: [true] } 25reducer(initState, setFlag(true)) // { flag: true }
1const { createAction, reducer } = ActionReducer(initState) 2// OR 3// const { createAction, reducer } = ActionReducer<State>() 4 5// just specify the type in the argument 6export const setFlag = createAction( 7 'SET_FLAG', 8 (state, arg1: boolean) => 9 ({ ...state, flag: arg1 }) 10)
You can use it the same way as before.
1// components/some-component.js 2import { setFlag, toggleFlag } from '../modules/flag' 3 4dispatch(setFlag(true))
1// modules/index.js 2import { combineReducers } from 'redux' 3import flag from './flag' 4 5export default combineReducers({ 6 flag: flag, 7})
1const { createAction } = ActionReducer(initState, 'PREFIX/')
2
3// with prefix
4const fooAction = createAction('foo', fooFn)
5fooAction.type // PREFIX/foo
6fooAction() // { type: 'PREFIX/foo', payload: [] }
7
8// The prefix is ignored when specifying an object
9const barAction = createAction({ type: 'bar' }, barFn)
10barAction.type // bar
11barAction() // { type: 'bar', payload: [] }
ActionReducer<State>(initState, prefix?)
State
): Redux initial State. (Optional arg for React useReducer
)string
): Prefix for action type. (Optional arg){ createAction: CreateAction, reducer: Reducer }
): CreateAction and Reducer.CreateAction<Payload>(type?, mutation)
string | symbol | { type: string }
): Action type. (Optional arg)(state: State, ...args: Payload) => State
): Mutation for this action.AcitonCreator
): Action creator function.AcitonCreator(...args: Payload)
Payload
): Action args.{ type: string | symbol, payload: Payload }
): Action object.Reducer(state: State, action: any)
State
): Current state.any
): Action object.State
): New state.No vulnerabilities found.
Reason
no binaries found in the repo
Reason
license file detected
Details
Reason
0 commit(s) and 0 issue activity found in the last 90 days -- score normalized to 0
Reason
Found 0/30 approved changesets -- score normalized to 0
Reason
no SAST tool detected
Details
Reason
no effort to earn an OpenSSF best practices badge detected
Reason
security policy file not detected
Details
Reason
project is not fuzzed
Details
Reason
branch protection not enabled on development/release branches
Details
Reason
24 existing vulnerabilities detected
Details
Score
Last Scanned on 2025-05-05
The Open Source Security Foundation is a cross-industry collaboration to improve the security of open source software (OSS). The Scorecard provides security health metrics for open source projects.
Learn More