Socket
Socket
Sign inDemoInstall

redux-state-branch

Package Overview
Dependencies
Maintainers
1
Versions
50
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

redux-state-branch - npm Package Compare versions

Comparing version 0.0.6 to 0.0.7

31

dist/index.d.ts

@@ -8,4 +8,3 @@ export declare const makeType: (prefix: string, suffix?: string | undefined) => string;

export declare type ID = string;
export interface IConstants {
[key: string]: string;
export declare type ConstantsT<C> = {
CREATE: string;

@@ -17,3 +16,3 @@ REPLACE: string;

SET_META: string;
}
} & C;
export interface IAction<T> {

@@ -39,5 +38,5 @@ type: string;

}
export declare class Actions<T> {
protected constant: IConstants;
constructor(constants: IConstants);
export declare class Actions<T, C> {
protected constant: ConstantsT<C>;
constructor(constants: ConstantsT<C>);
replace(items: ItemsT<T>, devToolsSuffix?: string): {

@@ -71,10 +70,8 @@ type: string;

}
interface IStateBranchOpts<T, A, S, U> {
interface IStateBranchOpts<T, A, S, C, U> {
name: string;
actions?: new (constants: IConstants) => A | Actions<T>;
actions?: new (constants: ConstantsT<C>) => A | Actions<T, C>;
selectors?: new (name: string) => S | Selectors<T>;
constants?: {
[key: string]: string;
};
utils?: U | {};
constants?: C;
utils?: U;
defaultItem?: {

@@ -88,7 +85,7 @@ [key: string]: any;

}
export declare class StateBranch<T, A, S, U> {
export declare class StateBranch<T, A, S, C, U> {
name: string;
constant: IConstants;
util: U | {};
action: A | Actions<T>;
constant: ConstantsT<C>;
util: U;
action: A | Actions<T, C>;
select: S | Selectors<T>;

@@ -102,5 +99,5 @@ defaultItem: {

protected extendedReducer: (state: IState, action: IAction<T>) => IState;
constructor({ name, actions: ActionsConstructor, selectors: SelectorsConstructor, constants, utils, defaultItem, defaultState, reducer }: IStateBranchOpts<T, A, S, U>);
constructor({ name, actions: ActionsConstructor, selectors: SelectorsConstructor, constants, utils, defaultItem, defaultState, reducer }: IStateBranchOpts<T, A, S, C, U>);
reducer(state: IState | undefined, action: IAction<T>): IState;
}
export {};

@@ -94,5 +94,6 @@ var __assign = (this && this.__assign) || function () {

function StateBranch(_a) {
var name = _a.name, _b = _a.actions, ActionsConstructor = _b === void 0 ? Actions : _b, _c = _a.selectors, SelectorsConstructor = _c === void 0 ? Selectors : _c, _d = _a.constants, constants = _d === void 0 ? {} : _d, _e = _a.utils, utils = _e === void 0 ? {} : _e, _f = _a.defaultItem, defaultItem = _f === void 0 ? {} : _f, _g = _a.defaultState, defaultState = _g === void 0 ? { items: {} } : _g, _h = _a.reducer, reducer = _h === void 0 ? function (state, action) { return state; } : _h;
var name = _a.name, _b = _a.actions, ActionsConstructor = _b === void 0 ? Actions : _b, _c = _a.selectors, SelectorsConstructor = _c === void 0 ? Selectors : _c, constants = _a.constants, utils = _a.utils, _d = _a.defaultItem, defaultItem = _d === void 0 ? {} : _d, _e = _a.defaultState, defaultState = _e === void 0 ? { items: {} } : _e, _f = _a.reducer, reducer = _f === void 0 ? function (state, action) { return state; } : _f;
this.name = name;
this.constant = __assign({}, constants, { CREATE: name + "/CREATE", REPLACE: name + "/REPLACE", UPDATE: name + "/UPDATE", DELETE: name + "/DELETE", SET_META: name + "/SET_META", RESET: name + "/RESET" });
// @ts-ignore
this.util = utils;

@@ -99,0 +100,0 @@ this.action = new ActionsConstructor(this.constant);

@@ -8,11 +8,11 @@ // @flow

declare type ItemsShapeT<T> = $Shape<T> | $Shape<T>[];
declare export interface IConstants {
[key: string]: string;
CREATE: string;
REPLACE: string;
UPDATE: string;
DELETE: string;
RESET: string;
SET_META: string;
}
declare export type ConstantsT<C> = {
CREATE: string,
REPLACE: string,
UPDATE: string,
DELETE: string,
RESET: string,
SET_META: string
} & C;
declare export interface IAction<T> {

@@ -40,5 +40,5 @@ type: string;

}
declare export class Actions<T> {
constant: IConstants;
constructor(constants: IConstants): this;
declare export class Actions<T, C> {
constant: ConstantsT<C>;
constructor(constants: ConstantsT<C>): this;
replace(

@@ -93,8 +93,8 @@ items: ItemsShapeT<T>,

}
declare interface IStateBranchOpts<T, A, S, U> {
declare interface IStateBranchOpts<T, A, S, C, U> {
name: string;
actions?: Class<A>;
selectors?: Class<S>;
constants?: { [key: string]: string };
utils?: U | {};
constants?: C;
utils?: U;
defaultItem?: {

@@ -108,6 +108,6 @@ [key: string]: any

}
declare export class StateBranch<T, A, S, U> {
declare export class StateBranch<T, A, S, C, U> {
name: string;
constant: IConstants;
util: U | {};
constant: ConstantsT<C>;
util: U;
action: A;

@@ -122,5 +122,5 @@ select: S;

extendedReducer: (state: IState, action: IAction<T>) => IState;
constructor(opts: IStateBranchOpts<T, A, S, U>): this;
constructor(opts: IStateBranchOpts<T, A, S, C, U>): this;
reducer(state: IState | void, action: IAction<T>): IState;
}
}
{
"name": "redux-state-branch",
"version": "0.0.6",
"version": "0.0.7",
"private": false,

@@ -5,0 +5,0 @@ "description": "A redux wrapper for sane people.",

Sorry, the diff of this file is not supported yet

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