Research
Security News
Quasar RAT Disguised as an npm Package for Detecting Vulnerabilities in Ethereum Smart Contracts
Socket researchers uncover a malicious npm package posing as a tool for detecting vulnerabilities in Etherium smart contracts.
combine-reducers-enhanced
Advanced tools
Extension on the combineReducers method as available in Redux libraries
Extension on the combineReducer method as available in Redux libraries
$ npm install --save combine-reducers-enhanced
import {combineReducersEnhanced} from "combine-reducers-enhanced";
const rootReducer = {
ui: {
login: loginReducer,
main: mainReducer
} ,
data: dataReducer
}
const enhancedRootReducer = combineReducersEnhanced(rootReducer);
let store: Store = new Store(enhancedRootReducer);
Every redux library provides us with a method called combineReducers
(if you don't know this check the documentation. This method is really helpful but has its limitations. This library was created to fix one of this limitations.
During design of your state tree, you typically divide it up into different sections. F.e.
{
ui: uiReducer,
data: dataReducer
}
@ngrx/store provides the combineReducers
method to easily work with such structures.
If you want to work with multiple levels of nesting in your state tree, you need to do something else F.e.
{
ui: {
login:...,
main: ...
} ,
data: ...
}
In that case, you'd could:
const rootReducer =
{
ui: combineReducers({
login: loginReducer,
main: mainReducer
}),
data: dataReducer
}
Option 1 provides you with extra work and option 2 forces you to work with a third party library. I personally prefer option 3 where you nest the combineReducers method inside your tree. This could actually be easily integrated into the current combineReducers method and make the following possible:
rootReducer = {
ui: {
login: loginReducer,
main: mainReducer
},
data: dataReducer
}
new Store(rootReducer)
It's a lot cleaner than approach where you nest the combineReducers method yourself. This implemented by making the combineReducers function recursive.
MIT © KwintenP
FAQs
Extension on the combineReducers method as available in Redux libraries
The npm package combine-reducers-enhanced receives a total of 1,291 weekly downloads. As such, combine-reducers-enhanced popularity was classified as popular.
We found that combine-reducers-enhanced 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.
Research
Security News
Socket researchers uncover a malicious npm package posing as a tool for detecting vulnerabilities in Etherium smart contracts.
Security News
Research
A supply chain attack on Rspack's npm packages injected cryptomining malware, potentially impacting thousands of developers.
Research
Security News
Socket researchers discovered a malware campaign on npm delivering the Skuld infostealer via typosquatted packages, exposing sensitive data.