Security News
New Python Packaging Proposal Aims to Solve Phantom Dependency Problem with SBOMs
PEP 770 proposes adding SBOM support to Python packages to improve transparency and catch hidden non-Python dependencies that security tools often miss.
redux-automap
Advanced tools
Redux helper library to greatly reduce action+reducer definition boilerplate.
Because much of the redux boilerplate (defining consts, logic in reducers to match actions to reducers, etc) really isn't necessary if you define actions with matching reducers together.
import { automap } from 'redux-automap'
const todos = automap({
initialState: [],
actionReducers: [
{
addTodo: text => ({ type: 'ADD_TODO', text }),
reducer: (state, action) => [ ...state, action.text ]
},
{
clearTodos: () => ({ type: 'CLEAR_TODOS' }),
reducer: state => []
}
]
})
/*
todos === {
actions: { // exposed for access to action creators
addTodo,
clearTodos
}
reducer: (state, action) // exposed as the main reducer for each branch
}
*/
const { addTodo, clearTodos } = todos.actions
const washClothesAction = addTodo('wash clothes') // { type: 'ADD_TODO', text: 'wash clothes' }
const foldClothesAction = addTodo('fold, clothes') // { type: 'ADD_TODO', text: 'fold clothes' }
let state = []
state = todos.reduce(state, washClothesAction) // state === [ 'wash clothes' ]
state = todos.reduce(state, foldClothesAction) // state === [ 'wash clothes', 'fold clothes' ]
state = todos.reduce(state, clearTodos()) // state === [ ]
import { automap } from 'redux-automap'
const category = automap({
initialState: 'dogs',
actionReducers: [
{
setCategory: category => ({ type: 'SET_CATEGORY', category }),
setCategoryToBirds: () => ({ type: 'SET_CATEGORY', category: 'birds' }),
reducer: (state, action) => action.category // both actions will use this shared reducer
}
]
})
const { setCategory, setCategoryToBirds } = todos.actions
let state = 'dogs'
state = todos.reduce(state, setCategory('cats')) // state === 'cats'
state = todos.reduce(state, setCategoryToBirds()) // state === 'birds'
v1.1.0 - added ability for multiple actions paired to one reducer v1.2.0 - added optional pass-through selector namespacing for use with combined reducers (docs to follow) v1.3.0 - actions and selectors are now automatically mapped onto default return (convenience)
FAQs
Redux helper library to greatly reduce action+reducer definition boilerplate.
We found that redux-automap 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.
Security News
PEP 770 proposes adding SBOM support to Python packages to improve transparency and catch hidden non-Python dependencies that security tools often miss.
Security News
Socket CEO Feross Aboukhadijeh discusses open source security challenges, including zero-day attacks and supply chain risks, on the Cyber Security Council podcast.
Security News
Research
Socket researchers uncover how threat actors weaponize Out-of-Band Application Security Testing (OAST) techniques across the npm, PyPI, and RubyGems ecosystems to exfiltrate sensitive data.