UNPKG

redux-retype-actions

Version:
26 lines (24 loc) 636 B
"use strict"; Object.defineProperty(exports, "__esModule", { value: true }); var enableRetyping = exports.enableRetyping = function enableRetyping(reducer) { return function retypedReducer(state, action) { if (action.retype) { return retypedReducer(retypedReducer(state, { type: action.type, payload: action.payload, action: action.action }), action.action); } return reducer(state, action); }; }; var retypeAction = exports.retypeAction = function retypeAction(type, action, payload) { return { type: type, action: action, payload: payload, retype: true }; };