app-redux-utils
Advanced tools
Comparing version 1.0.2 to 1.1.0
@@ -1,3 +0,2 @@ | ||
import { AppAction } from "./AppAction"; | ||
export declare function createAction(actionType: string, data?: any): AppAction; | ||
export declare function createActionWithCallback(actionType: string, data?: any): (callbackAction?: () => AppAction) => AppAction; | ||
import { AppAction } from "./types"; | ||
export declare function createAction(actionType: string, payload?: any): AppAction; |
@@ -1,24 +0,12 @@ | ||
export function createAction(actionType, data = {}) { | ||
let payload; | ||
if (typeof data === "object" && !Array.isArray(data)) { | ||
payload = Object.assign({}, data); | ||
import { AppAction } from "./types"; | ||
export function createAction(actionType, payload = {}) { | ||
let _payload; | ||
if (typeof payload === "object" && !Array.isArray(payload)) { | ||
_payload = Object.assign({}, payload); | ||
} | ||
else { | ||
payload = data; | ||
_payload = payload; | ||
} | ||
return { | ||
type: actionType, | ||
payload, | ||
}; | ||
return new AppAction(actionType, _payload); | ||
} | ||
export function createActionWithCallback(actionType, data = {}) { | ||
const action = createAction(actionType, data); | ||
const actionWithCallback = (callbackAction) => { | ||
if (typeof callbackAction === "function") { | ||
return Object.assign(Object.assign({}, action), { callbackAction }); | ||
} | ||
return action; | ||
}; | ||
return actionWithCallback; | ||
} | ||
//# sourceMappingURL=createAction.js.map |
@@ -1,4 +0,4 @@ | ||
export { AppAction } from "./AppAction"; | ||
export * from "./createAction"; | ||
export { createReducers } from "./createReducers"; | ||
export { Reducer } from "./Reducer"; | ||
export * from "./createActionWithCallback"; | ||
export * from "./createReducers"; | ||
export * from "./types"; |
export * from "./createAction"; | ||
export { createReducers } from "./createReducers"; | ||
export { Reducer } from "./Reducer"; | ||
export * from "./createActionWithCallback"; | ||
export * from "./createReducers"; | ||
export * from "./types"; | ||
//# sourceMappingURL=index.js.map |
{ | ||
"name": "app-redux-utils", | ||
"version": "1.0.2", | ||
"version": "1.1.0", | ||
"description": "Helpful utils for redux", | ||
@@ -5,0 +5,0 @@ "contributors": [ |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
17669
39
125