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

app-redux-utils

Package Overview
Dependencies
Maintainers
1
Versions
26
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

app-redux-utils - npm Package Compare versions

Comparing version 1.1.2 to 1.2.0

dist/types/Action.d.ts

4

dist/createAction.d.ts

@@ -1,2 +0,2 @@

import { IAppAction } from "./types";
export declare function createAction(actionType: string, payload?: any): IAppAction;
import { Action } from "./types";
export declare function createAction(actionType: string, payload?: any): Action;

@@ -1,2 +0,2 @@

import { AppAction } from "./types";
import { AppAction } from "./types/AppAction";
export function createAction(actionType, payload = {}) {

@@ -3,0 +3,0 @@ let _payload;

@@ -1,3 +0,3 @@

import { IAppAction } from "./IAppAction";
import { Action } from "./Action";
import { CallbackAction } from "./CallbackAction";
export declare type ActionWithCallback = (callbackAction: CallbackAction) => IAppAction;
export declare type ActionWithCallback = (callbackAction: CallbackAction) => Action;

@@ -0,1 +1,2 @@

export {};
//# sourceMappingURL=ActionWithCallback.js.map

@@ -1,6 +0,6 @@

import { IAppAction } from "./IAppAction";
import { Action } from "./Action";
import { CallbackAction } from "./CallbackAction";
export declare class AppAction<TPayload = any> implements IAppAction<TPayload> {
export declare class AppAction<TPayload = {}> implements Action<TPayload> {
type: any;
payload?: TPayload;
payload: TPayload;
callbackAction?: CallbackAction;

@@ -10,7 +10,7 @@ actions?: AppAction[];

constructor(type: string, payload?: TPayload);
static stop(appAction: IAppAction): void;
static getActions(appAction: IAppAction): CallbackAction[];
static stop(appAction: Action): void;
static getActions(appAction: Action): CallbackAction[];
stop(): void;
getActions(): CallbackAction[];
toPlainObject(): IAppAction;
toPlainObject(): Action;
}

@@ -17,3 +17,3 @@ export class AppAction {

if (Array.isArray(appAction.actions) && appAction.actions.length > 0) {
appAction.actions.forEach(action => {
appAction.actions.forEach((action) => {
actions.push(() => action);

@@ -33,3 +33,3 @@ });

const plainObject = {};
keys.forEach(key => {
keys.forEach((key) => {
if (key !== "toPlainObject") {

@@ -36,0 +36,0 @@ // @ts-ignore

@@ -1,2 +0,2 @@

import { IAppAction } from "./IAppAction";
export declare type CallbackAction = () => IAppAction;
import { Action } from "./Action";
export declare type CallbackAction = () => Action;

@@ -0,1 +1,2 @@

export {};
//# sourceMappingURL=CallbackAction.js.map
export * from "./ActionWithCallback";
export * from "./IAppAction";
export * from "./AppAction";
export * from "./Action";
export * from "./CallbackAction";
export * from "./Reducer";

@@ -1,3 +0,5 @@

export * from "./AppAction";
export * from "./ActionWithCallback";
export * from "./Action";
export * from "./CallbackAction";
export * from "./Reducer";
//# sourceMappingURL=index.js.map

@@ -1,3 +0,3 @@

import { IAppAction } from "./IAppAction";
declare function Reducer<TStore>(initialStore: TStore, updateActionType: string): (store: TStore | undefined, action: IAppAction<any>) => TStore;
import { Action } from "./Action";
declare function Reducer<TStore>(initialStore: TStore, updateActionType: string): (store: TStore | undefined, action: Action) => TStore;
export { Reducer };
function Reducer(initialStore, updateActionType) {
return (store = initialStore, action) => {
if (action.type === updateActionType) {
if (action.type !== updateActionType) {
return store;
}
if (typeof action.payload === 'object') {
return Object.assign(Object.assign({}, store), action.payload);
}
return store;
return Object.assign({}, store);
};

@@ -8,0 +11,0 @@ }

{
"name": "app-redux-utils",
"version": "1.1.2",
"version": "1.2.0",
"description": "Helpful utils for redux",

@@ -5,0 +5,0 @@ "contributors": [

@@ -132,3 +132,3 @@ # Installation

import { put } from "@redux-saga/core/effects";
import { AppAction } from "app-redux-utils";
import { Action } from "app-redux-utils";

@@ -144,3 +144,3 @@ import { UsersApi } from "@api/UsersApi";

public static* loadUsers(action: AppAction) {
public static* loadUsers(action: Action) {
// some logic ...

@@ -153,3 +153,3 @@

public static* loadUser(action: AppAction<ILoadUserData>) {
public static* loadUser(action: Action<ILoadUserData>) {
// some logic ...

@@ -173,3 +173,3 @@

import { ForkEffect, put, PutEffect, TakeEffect, takeLatest } from "@redux-saga/core/effects";
import { AppAction } from "app-redux-utils";
import { Action } from "app-redux-utils";

@@ -201,4 +201,4 @@ import { UsersActions } from "../redux/Users.actions";

private getSagaWithCallbackAction(saga: (action: AppAction) => void): (action: AppAction) => void {
return function* (action: AppAction) {
private getSagaWithCallbackAction(saga: (action: Action) => void): (action: Action) => void {
return function* (action: Action) {
yield saga(action);

@@ -214,3 +214,3 @@

private watchLatest(actionType: string, saga: (action: AppAction) => void) {
private watchLatest(actionType: string, saga: (action: Action) => void) {
const sagaWithCallbackAction = this.getSagaWithCallbackAction(saga);

@@ -217,0 +217,0 @@ this.watchFunctions.push(

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

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