
Product
Announcing Socket Fix 2.0
Socket Fix 2.0 brings targeted CVE remediation, smarter upgrade planning, and broader ecosystem support to help developers get to zero alerts.
action-types
Advanced tools
Conveniently create action types with multi-level namespace support.
A note about compatibility
The npm package should be used in an ES6 environment. Even though the published code has ES5 syntax it uses some ES6 features, so you have to make sure to use ES5 and ES6 polyfills if you are in an ancient environment.
npm install action-types
import { ActionType, createActionTypes } from './action-types'
createActionTypes({
START_APP: ActionType,
user: {
ADD: ActionType,
REMOVE: ActionType,
current: {
SET: ActionType,
CHANGE: ActionType
}
}
})
// results in:
{
START_APP: 'START_APP',
user: {
ADD: 'user.ADD',
REMOVE: 'user.REMOVE',
CHANGE: 'user.CHANGE',
current: {
SET: 'user.current.SET',
CHANGE: 'user.current.CHANGE'
}
}
}
import { ActionType, createActionTypes } from './action-types'
createActionTypes({
ADD: ActionType,
REMOVE: ActionType
}, {
namespace: 'user'
})
// results in:
{
ADD: 'user.ADD',
REMOVE: 'user.REMOVE'
}
import { ActionType, createActionTypes } from './action-types'
createActionTypes({
user: {
ADD: ActionType,
REMOVE: ActionType
}
}, {
separator: '::'
})
// results in:
{
ADD: 'user::ADD',
REMOVE: 'user::REMOVE'
}
npm test
FAQs
Conveniently create action types with nested namespace support.
We found that action-types demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 1 open source maintainer collaborating on the project.
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.
Product
Socket Fix 2.0 brings targeted CVE remediation, smarter upgrade planning, and broader ecosystem support to help developers get to zero alerts.
Security News
Socket CEO Feross Aboukhadijeh joins Risky Business Weekly to unpack recent npm phishing attacks, their limited impact, and the risks if attackers get smarter.
Product
Socket’s new Tier 1 Reachability filters out up to 80% of irrelevant CVEs, so security teams can focus on the vulnerabilities that matter.