Security News
PyPI’s New Archival Feature Closes a Major Security Gap
PyPI now allows maintainers to archive projects, improving security and helping users make informed decisions about their dependencies.
@workpop/dux
Advanced tools
Workpop Redux Tools and Composers
These composers can be used in the style of a higher order function to add common reducer transforms to redux stores.
import { withSet } from '@workpop/dux';
const SET = 'SET';
const reducer = withSet(SET)((state = 'bar', action = {}) => {
switch(action.type) {
// other reducer cases
default:
return state;
}
});
// from redux
const store = createStore(reducer);
// actions like normal
store.dispatch({
type: SET,
data: 'foo',
});
// state will be "foo"
Using compose
from recompose
or flowRight
from lodash
will let you chain enhancers together.
import { flowRight } from 'lodash';
import { withSet, withClear } from '@workpop/dux';
const SET = 'SET';
const CLEAR = 'CLEAR';
const enhancer = flowRight(
withSet(SET),
withClear(CLEAR),
);
const reducer = enhancer((state = 'bar', action = {}) => {
switch(action.type) {
// other reducer cases
default:
return state;
}
});
const store = createStore(reducer);
store.dispatch({
type: SET,
data: 'foo',
});
// state will be "foo"
store.dispatch({
type: CLEAR,
});
// state will be "bar"
Finally, composeReducer
passes its last argument to the previous combined composers.
import { composeReducer, withSet } from '@workpop/dux';
const SET = 'SET';
const CLEAR = 'CLEAR';
const reducer = composeReducer(
withClear(CLEAR),
withSet(SET),
// reducer is the last argument
(state = 'bar', action = {}) => {
switch(action.type) {
// other reducer cases
default:
return state;
}
},
);
const store = createStore(reducer);
store.dispatch({
type: SET,
data: 'foo',
});
// state will be "foo"
store.dispatch({
type: CLEAR,
});
// state will be "bar"
TODO
TODO
TODO
FAQs
HOC Redux Functions
The npm package @workpop/dux receives a total of 8 weekly downloads. As such, @workpop/dux popularity was classified as not popular.
We found that @workpop/dux demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 17 open source maintainers 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
PyPI now allows maintainers to archive projects, improving security and helping users make informed decisions about their dependencies.
Research
Security News
Malicious npm package postcss-optimizer delivers BeaverTail malware, targeting developer systems; similarities to past campaigns suggest a North Korean connection.
Security News
CISA's KEV data is now on GitHub, offering easier access, API integration, commit history tracking, and automated updates for security teams and researchers.