Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

reducer-composer

Package Overview
Dependencies
Maintainers
1
Versions
7
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

reducer-composer - npm Package Compare versions

Comparing version 0.0.7 to 0.0.8

dist/createDecoratedReducer.d.ts

3

dist/createKeyedByReducer.d.ts
import { Reducer } from "./utility";
/**
* @todo filter unknown actions, cannot be called with unknown actions (cannot be used as is in createCombinedReducer)
*/
export declare function createKeyedByReducer<State, Action extends {

@@ -3,0 +6,0 @@ type: string;

@@ -14,4 +14,8 @@ "use strict";

Object.defineProperty(exports, "__esModule", { value: true });
/**
* @todo filter unknown actions, cannot be called with unknown actions (cannot be used as is in createCombinedReducer)
*/
function createKeyedByReducer(keySelector, reducer) {
return function (state, action) {
if (state === void 0) { state = {}; }
var _a;

@@ -18,0 +22,0 @@ var key = keySelector(action);

import { Reducer } from "./utility";
/**
* @todo filter unknown actions, cannot be called with unknown actions (cannot be used as is in createCombinedReducer)
*/
export declare function createKeyedReducer<KeyAttribute extends string, State, Action extends {

@@ -3,0 +6,0 @@ type: string;

@@ -23,4 +23,8 @@ "use strict";

Object.defineProperty(exports, "__esModule", { value: true });
/**
* @todo filter unknown actions, cannot be called with unknown actions (cannot be used as is in createCombinedReducer)
*/
function createKeyedReducer(keyAttribute, reducer) {
return function (state, action) {
if (state === void 0) { state = {}; }
var _a;

@@ -27,0 +31,0 @@ var type = action.type, _b = action.payload, _c = keyAttribute, key = _b[_c], payload = __rest(_b, [typeof _c === "symbol" ? _c : _c + ""]);

@@ -12,3 +12,4 @@ export { createReducer } from "./createReducer";

export { createReducerAdapter } from "./createReducerAdapter";
export { createDecoratedReducer } from "./createDecoratedReducer";
export { withInitialState } from "./withInitialState";
export * from "./utility";

@@ -28,4 +28,6 @@ "use strict";

exports.createReducerAdapter = createReducerAdapter_1.createReducerAdapter;
var createDecoratedReducer_1 = require("./createDecoratedReducer");
exports.createDecoratedReducer = createDecoratedReducer_1.createDecoratedReducer;
var withInitialState_1 = require("./withInitialState");
exports.withInitialState = withInitialState_1.withInitialState;
__export(require("./utility"));

@@ -8,4 +8,2 @@ export declare type Values<O> = O[keyof O];

export declare type StateOfReducer<R extends Reducer<any, any>> = ReturnType<R>;
export declare function ignore<State>(state: State): State;
export declare function get<Attribute extends string>(attribute: Attribute): <Value>(object: { [K in Attribute]: Value; }) => { [K in Attribute]: Value; }[Attribute];
export interface DeepReadonlyArray<A> extends ReadonlyArray<DeepReadonly<A>> {

@@ -17,1 +15,11 @@ }

export declare type DeepReadonly<A> = A extends Array<infer B> ? DeepReadonlyArray<B> : DeepReadonlyObject<A>;
export declare function ignore<State>(state: State): State;
export declare function get<Attribute extends string>(attribute: Attribute): <Value>(object: { [K in Attribute]: Value; }) => { [K in Attribute]: Value; }[Attribute];
export declare function actionOfType<ActionType extends string>(actionType: ActionType): <Payload>(payload: Payload) => {
type: ActionType;
payload: Payload;
};
export declare function runActionsOnReducer<State, Action extends {
type: string;
payload?: any;
}>(reducer: Reducer<State, Action>, state: State, actions: Action[]): State;

@@ -11,1 +11,9 @@ "use strict";

exports.get = get;
function actionOfType(actionType) {
return function (payload) { return ({ type: actionType, payload: payload }); };
}
exports.actionOfType = actionOfType;
function runActionsOnReducer(reducer, state, actions) {
return actions.reduce(reducer, state);
}
exports.runActionsOnReducer = runActionsOnReducer;

2

package.json

@@ -11,3 +11,3 @@ {

],
"version": "0.0.7",
"version": "0.0.8",
"license": "MIT",

@@ -14,0 +14,0 @@ "author": "Frederik Batuna",

import { Reducer } from "./utility";
/**
* @todo filter unknown actions, cannot be called with unknown actions (cannot be used as is in createCombinedReducer)
*/
export function createKeyedByReducer<

@@ -13,3 +16,3 @@ State,

): Reducer<Record<string, State>, Action> {
return (state, action) => {
return (state = {}, action) => {
const key = keySelector(action);

@@ -16,0 +19,0 @@ return {

import { Reducer } from "./utility";
/**
* @todo filter unknown actions, cannot be called with unknown actions (cannot be used as is in createCombinedReducer)
*/
export function createKeyedReducer<

@@ -14,3 +17,3 @@ KeyAttribute extends string,

> {
return (state, action) => {
return (state = {}, action) => {
const {

@@ -17,0 +20,0 @@ type,

@@ -12,3 +12,4 @@ export { createReducer } from "./createReducer";

export { createReducerAdapter } from "./createReducerAdapter";
export { createDecoratedReducer } from "./createDecoratedReducer";
export { withInitialState } from "./withInitialState";
export * from "./utility";

@@ -11,9 +11,2 @@ export type Values<O> = O[keyof O];

export function ignore<State>(state: State) {
return state;
}
export function get<Attribute extends string>(attribute: Attribute) {
return <Value>(object: { [K in Attribute]: Value }) => object[attribute];
}
export interface DeepReadonlyArray<A> extends ReadonlyArray<DeepReadonly<A>> {}

@@ -28,1 +21,22 @@

: DeepReadonlyObject<A>;
export function ignore<State>(state: State) {
return state;
}
export function get<Attribute extends string>(attribute: Attribute) {
return <Value>(object: { [K in Attribute]: Value }) => object[attribute];
}
export function actionOfType<ActionType extends string>(
actionType: ActionType
) {
return <Payload>(payload: Payload) => ({ type: actionType, payload });
}
export function runActionsOnReducer<
State,
Action extends { type: string; payload?: any }
>(reducer: Reducer<State, Action>, state: State, actions: Action[]) {
return actions.reduce(reducer, state);
}
SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc