
Research
Malicious npm Packages Impersonate Flashbots SDKs, Targeting Ethereum Wallet Credentials
Four npm packages disguised as cryptographic tools steal developer credentials and send them to attacker-controlled Telegram infrastructure.
ngrx-action-mapper
Advanced tools
Simple utility for building Ngrx reducer with less boilerplate
Simple utility for building Ngrx reducer with less boilerplate
Install the npm package: ngrx-action-mapper
# with npm
npm install ngrx-action-mapper
# or with yarn
yarn add ngrx-action-mapper
// src/app/store/users.reducer.ts
import { createEntityAdapter, EntityAdapter, EntityState } from '@ngrx/entity';
import { Action } from '@ngrx/store';
import { EntityActionMapper } from 'ngrx-action-mapper';
export interface User {
id: string;
name: string;
}
export abstract class BaseAction<Payload = never> {
public type: string = this.constructor.name;
constructor(public payload?: Payload) {}
}
export class AddOneUserAction extends BaseAction<User> {}
export class RemoveOneUserAction extends BaseAction<string> {}
export class SelectUserAction extends BaseAction<User> {}
export interface UsersState extends EntityState<User> {
// additional entity state properties
selectedUserId: string | null;
}
export interface UsersRootState extends EntityState<User> {
users: UsersState;
}
export const usersAdapter: EntityAdapter<User> = createEntityAdapter<User>();
export const initialUsersState: UsersState = usersAdapter.getInitialState({
selectedUserId: null,
});
export const actionReducer = new EntityActionMapper(initialUsersState, usersAdapter)
.mapEntityAction(AddOneUserAction, adapter => adapter.addOne)
.mapEntityAction(RemoveOneUserAction, adapter => adapter.removeOne)
.add(
SelectUserAction,
(state: UsersState, user: User): UsersState => {
return { ...state, selectedUserId: user.id };
},
)
.buildReducer();
export function usersReducer(state: UsersState, action: Action): UsersState {
return actionReducer(state, action);
}
FAQs
Simple utility for building Ngrx reducer with less boilerplate
The npm package ngrx-action-mapper receives a total of 0 weekly downloads. As such, ngrx-action-mapper popularity was classified as not popular.
We found that ngrx-action-mapper 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
Four npm packages disguised as cryptographic tools steal developer credentials and send them to attacker-controlled Telegram infrastructure.
Security News
Ruby maintainers from Bundler and rbenv teams are building rv to bring Python uv's speed and unified tooling approach to Ruby development.
Security News
Following last week’s supply chain attack, Nx published findings on the GitHub Actions exploit and moved npm publishing to Trusted Publishers.