Socket
Socket
Sign inDemoInstall

typesafe-actions

Package Overview
Dependencies
0
Maintainers
1
Versions
49
Alerts
File Explorer

Advanced tools

Install Socket

Detect and block malicious and high-risk dependencies

Install

Comparing version 4.4.0 to 4.4.1

16

dist/create-reducer.d.ts
import { Reducer, Action, Types } from './type-helpers';
export declare type RootAction = Types extends {
RootAction: infer T;
} ? T : any;
declare type CreateReducerChainApi<TState, TPrevNotHandledAction extends Action, TRootAction extends Action> = <TType extends TPrevNotHandledAction['type'], THandledTypeAction extends TPrevNotHandledAction extends Action<TType> ? TPrevNotHandledAction : never, TCreator extends (...args: any[]) => TPrevNotHandledAction, THandledCreatorAction extends TPrevNotHandledAction extends ReturnType<TCreator> ? TPrevNotHandledAction : never, THandledAction extends THandledTypeAction extends THandledCreatorAction ? THandledTypeAction : never>(singleOrMultipleCreatorsAndTypes: TType | TType[] | TCreator | TCreator[], reducer: (state: TState, action: THandledAction) => TState) => [Exclude<TPrevNotHandledAction, THandledTypeAction & THandledCreatorAction>] extends [never] ? Reducer<TState, TRootAction> & {
declare type CreateReducerChainApi<TState, TPrevNotHandledAction extends Action, TRootAction extends Action> = <TType extends TPrevNotHandledAction['type'], TCreator extends (...args: any[]) => TPrevNotHandledAction, TNextNotHandledAction extends Exclude<TPrevNotHandledAction, Action<TType> & ReturnType<TCreator>>, TAction extends TPrevNotHandledAction extends Action<TType> ? TPrevNotHandledAction extends ReturnType<TCreator> ? TPrevNotHandledAction : never : never>(singleOrMultipleCreatorsAndTypes: TType | TType[] | TCreator | TCreator[], reducer: (state: TState, action: TAction) => TState) => [TNextNotHandledAction] extends [never] ? Reducer<TState, TRootAction> & {
handlers: Record<TRootAction['type'], (state: TState, action: TRootAction) => TState>;
} : Reducer<TState, TRootAction> & {
handlers: Record<Exclude<TRootAction, Exclude<TPrevNotHandledAction, THandledTypeAction & THandledCreatorAction>>['type'], (state: TState, action: TRootAction) => TState>;
handleAction: CreateReducerChainApi<TState, Exclude<TPrevNotHandledAction, THandledTypeAction & THandledCreatorAction>, TRootAction>;
handlers: Record<Exclude<TRootAction, TNextNotHandledAction>['type'], (state: TState, action: TRootAction) => TState>;
handleAction: CreateReducerChainApi<TState, TNextNotHandledAction, TRootAction>;
};

@@ -15,8 +12,9 @@ declare type GetAction<TAction extends Action, TType extends TAction['type']> = TAction extends Action<TType> ? TAction : never;

};
declare type RootAction = Types extends {
RootAction: infer T;
} ? T : any;
export declare function createReducer<TState, TRootAction extends Action = RootAction>(initialState: TState, initialHandlers?: InitialHandler<TState, TRootAction>): Reducer<TState, TRootAction> & {
handlers: {
readonly [x: string]: ((state: TState, action: any) => TState) | undefined;
};
readonly handlers: any;
readonly handleAction: CreateReducerChainApi<TState, TRootAction, TRootAction>;
};
export {};
'use strict';
function checkIsEmpty(arg, argPosition) {
if (argPosition === void 0) {
argPosition = 1;
}

@@ -8,0 +5,0 @@ return arg == null;

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

"use strict";function n(n,t){return void 0===t&&(t=1),null==n}function t(n){throw void 0===n&&(n=1),new Error("Argument "+n+" is empty.")}function r(n){return"function"==typeof n&&"getType"in n}function e(n){throw void 0===n&&(n=1),new Error("Argument "+n+' is invalid, it should be an action-creator instance from "typesafe-actions"')}function o(n,t){if(null==n)throw new Error("Argument contains array with empty element at index "+t);if(null==n.getType)throw new Error("Argument contains array with invalid element at index "+t+', it should be an action-creator instance from "typesafe-actions"')}function i(n){return"string"==typeof n||"symbol"==typeof n}function u(n){return!i(n)}function c(n){throw void 0===n&&(n=1),new Error("Argument "+n+" is invalid, it should be an action type of type: string | symbol")}function a(n,t){if(null==n)throw new Error("Argument contains array with empty element at index "+t);if("string"!=typeof n&&"symbol"!=typeof n)throw new Error("Argument contains array with invalid element at index "+t+", it should be of type: string | symbol")}function s(r,o,i,c){return n(r)&&t(1),u(r)&&e(1),{type:r,payload:o,meta:i,error:c}}function f(r,e){n(r)&&t(1),u(r)&&c(1);var o=null!=e?e(r):function(){return{type:r}};return Object.assign(o,{getType:function(){return r},toString:function(){return r}})}function y(r){return n(r)&&t(1),u(r)&&c(1),Object.assign(function(){return f(r,function(n){return function(t,r){return{type:n,payload:t,meta:r}}})},{map:function(n){return f(r,function(t){return function(r,e){return Object.assign(n(r,e),{type:t})}})}})}function p(o){return n(o)&&t(1),r(o)||e(1),o.getType()}exports.action=s,exports.createAction=function(n,t){var r=null==t?function(){return s(n)}:t(s.bind(null,n));return Object.assign(r,{getType:function(){return n},toString:function(){return n}})},exports.createActionDeprecated=function(n,t){var r;if(null!=t){if("function"!=typeof t)throw new Error("second argument is not a function");r=t}else r=function(){return{type:n}};if(null==n)throw new Error("first argument is missing");if("string"!=typeof n&&"symbol"!=typeof n)throw new Error("first argument should be type of: string | symbol");return r},exports.createAsyncAction=function(n,t,r,e){return[n,t,r].forEach(a),Object.assign(function(){return{request:y(n)(),success:y(t)(),failure:y(r)(),cancel:e&&y(e)()}},{})},exports.createCustomAction=f,exports.createReducer=function n(t,e){void 0===e&&(e={});var o=Object.assign({},e);return Object.assign(function(n,r){if(void 0===n&&(n=t),o.hasOwnProperty(r.type)){var e=o[r.type];if("function"!=typeof e)throw Error('Reducer under "'+r.type+'" key is not a valid reducer');return e(n,r)}return n},{handlers:Object.assign({},o),handleAction:function(e,u){var c=Array.isArray(e)?e:[e],a={};return c.map(function(n){return r(n)?p(n):i(n)?n:function(n){throw void 0===n&&(n=1),new Error("Argument "+n+' is invalid, it should be an action-creator instance from "typesafe-actions" or action type of type: string | symbol')}()}).forEach(function(n){return a[n]=u}),n(t,Object.assign({},o,a))}})},exports.createStandardAction=y,exports.getType=p,exports.isActionOf=function(r,e){n(r)&&t(1);var i=Array.isArray(r)?r:[r];i.forEach(o);var u=function(n){return i.some(function(t){return n.type===t.getType()})};return void 0===e?u:u(e)},exports.isOfType=function(r,e){n(r)&&t(1);var o=Array.isArray(r)?r:[r];o.forEach(a);var i=function(n){return o.includes(n.type)};return void 0===e?i:i(e)};
"use strict";function n(n,t){return null==n}function t(n){throw void 0===n&&(n=1),new Error("Argument "+n+" is empty.")}function r(n){return"function"==typeof n&&"getType"in n}function e(n){throw void 0===n&&(n=1),new Error("Argument "+n+' is invalid, it should be an action-creator instance from "typesafe-actions"')}function o(n,t){if(null==n)throw new Error("Argument contains array with empty element at index "+t);if(null==n.getType)throw new Error("Argument contains array with invalid element at index "+t+', it should be an action-creator instance from "typesafe-actions"')}function i(n){return"string"==typeof n||"symbol"==typeof n}function u(n){return!i(n)}function c(n){throw void 0===n&&(n=1),new Error("Argument "+n+" is invalid, it should be an action type of type: string | symbol")}function a(n,t){if(null==n)throw new Error("Argument contains array with empty element at index "+t);if("string"!=typeof n&&"symbol"!=typeof n)throw new Error("Argument contains array with invalid element at index "+t+", it should be of type: string | symbol")}function s(r,o,i,c){return n(r)&&t(1),u(r)&&e(1),{type:r,payload:o,meta:i,error:c}}function f(r,e){n(r)&&t(1),u(r)&&c(1);var o=null!=e?e(r):function(){return{type:r}};return Object.assign(o,{getType:function(){return r},toString:function(){return r}})}function y(r){return n(r)&&t(1),u(r)&&c(1),Object.assign(function(){return f(r,function(n){return function(t,r){return{type:n,payload:t,meta:r}}})},{map:function(n){return f(r,function(t){return function(r,e){return Object.assign(n(r,e),{type:t})}})}})}function p(o){return n(o)&&t(1),r(o)||e(1),o.getType()}exports.action=s,exports.createAction=function(n,t){var r=null==t?function(){return s(n)}:t(s.bind(null,n));return Object.assign(r,{getType:function(){return n},toString:function(){return n}})},exports.createActionDeprecated=function(n,t){var r;if(null!=t){if("function"!=typeof t)throw new Error("second argument is not a function");r=t}else r=function(){return{type:n}};if(null==n)throw new Error("first argument is missing");if("string"!=typeof n&&"symbol"!=typeof n)throw new Error("first argument should be type of: string | symbol");return r},exports.createAsyncAction=function(n,t,r,e){return[n,t,r].forEach(a),Object.assign(function(){return{request:y(n)(),success:y(t)(),failure:y(r)(),cancel:e&&y(e)()}},{})},exports.createCustomAction=f,exports.createReducer=function n(t,e){void 0===e&&(e={});var o=Object.assign({},e);return Object.assign(function(n,r){if(void 0===n&&(n=t),o.hasOwnProperty(r.type)){var e=o[r.type];if("function"!=typeof e)throw Error('Reducer under "'+r.type+'" key is not a valid reducer');return e(n,r)}return n},{handlers:Object.assign({},o),handleAction:function(e,u){var c=Array.isArray(e)?e:[e],a={};return c.map(function(n){return r(n)?p(n):i(n)?n:function(n){throw void 0===n&&(n=1),new Error("Argument "+n+' is invalid, it should be an action-creator instance from "typesafe-actions" or action type of type: string | symbol')}()}).forEach(function(n){return a[n]=u}),n(t,Object.assign({},o,a))}})},exports.createStandardAction=y,exports.getType=p,exports.isActionOf=function(r,e){n(r)&&t(1);var i=Array.isArray(r)?r:[r];i.forEach(o);var u=function(n){return i.some(function(t){return n.type===t.getType()})};return void 0===e?u:u(e)},exports.isOfType=function(r,e){n(r)&&t(1);var o=Array.isArray(r)?r:[r];o.forEach(a);var i=function(n){return o.includes(n.type)};return void 0===e?i:i(e)};
//# sourceMappingURL=typesafe-actions.cjs.production.js.map

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

function n(n,t){return void 0===t&&(t=1),null==n}function t(n){throw void 0===n&&(n=1),new Error("Argument "+n+" is empty.")}function r(n){return"function"==typeof n&&"getType"in n}function e(n){throw void 0===n&&(n=1),new Error("Argument "+n+' is invalid, it should be an action-creator instance from "typesafe-actions"')}function i(n,t){if(null==n)throw new Error("Argument contains array with empty element at index "+t);if(null==n.getType)throw new Error("Argument contains array with invalid element at index "+t+', it should be an action-creator instance from "typesafe-actions"')}function o(n){return"string"==typeof n||"symbol"==typeof n}function u(n){return!o(n)}function a(n){throw void 0===n&&(n=1),new Error("Argument "+n+" is invalid, it should be an action type of type: string | symbol")}function c(n,t){if(null==n)throw new Error("Argument contains array with empty element at index "+t);if("string"!=typeof n&&"symbol"!=typeof n)throw new Error("Argument contains array with invalid element at index "+t+", it should be of type: string | symbol")}function f(r,i,o,a){return n(r)&&t(1),u(r)&&e(1),{type:r,payload:i,meta:o,error:a}}function s(n,t){var r=null==t?function(){return f(n)}:t(f.bind(null,n));return Object.assign(r,{getType:function(){return n},toString:function(){return n}})}function y(r,e){n(r)&&t(1),u(r)&&a(1);var i=null!=e?e(r):function(){return{type:r}};return Object.assign(i,{getType:function(){return r},toString:function(){return r}})}function l(r){return n(r)&&t(1),u(r)&&a(1),Object.assign(function(){return y(r,function(n){return function(t,r){return{type:n,payload:t,meta:r}}})},{map:function(n){return y(r,function(t){return function(r,e){return Object.assign(n(r,e),{type:t})}})}})}function p(n,t,r,e){[n,t,r].forEach(c);return Object.assign(function(){return{request:l(n)(),success:l(t)(),failure:l(r)(),cancel:e&&l(e)()}},{})}function g(i){return n(i)&&t(1),r(i)||e(1),i.getType()}function d(n,t){void 0===t&&(t={});var e=Object.assign({},t);return Object.assign(function(t,r){if(void 0===t&&(t=n),e.hasOwnProperty(r.type)){var i=e[r.type];if("function"!=typeof i)throw Error('Reducer under "'+r.type+'" key is not a valid reducer');return i(t,r)}return t},{handlers:Object.assign({},e),handleAction:function(t,i){var u=Array.isArray(t)?t:[t],a={};return u.map(function(n){return r(n)?g(n):o(n)?n:function(n){throw void 0===n&&(n=1),new Error("Argument "+n+' is invalid, it should be an action-creator instance from "typesafe-actions" or action type of type: string | symbol')}()}).forEach(function(n){return a[n]=i}),d(n,Object.assign({},e,a))}})}function m(r,e){n(r)&&t(1);var i=Array.isArray(r)?r:[r];i.forEach(c);var o=function(n){return i.includes(n.type)};return void 0===e?o:o(e)}function h(r,e){n(r)&&t(1);var o=Array.isArray(r)?r:[r];o.forEach(i);var u=function(n){return o.some(function(t){return n.type===t.getType()})};return void 0===e?u:u(e)}function w(n,t){var r;if(null!=t){if("function"!=typeof t)throw new Error("second argument is not a function");r=t}else r=function(){return{type:n}};if(null==n)throw new Error("first argument is missing");if("string"!=typeof n&&"symbol"!=typeof n)throw new Error("first argument should be type of: string | symbol");return r}export{f as action,s as createAction,w as createActionDeprecated,p as createAsyncAction,y as createCustomAction,d as createReducer,l as createStandardAction,g as getType,h as isActionOf,m as isOfType};
function n(n,t){return null==n}function t(n){throw void 0===n&&(n=1),new Error("Argument "+n+" is empty.")}function r(n){return"function"==typeof n&&"getType"in n}function e(n){throw void 0===n&&(n=1),new Error("Argument "+n+' is invalid, it should be an action-creator instance from "typesafe-actions"')}function i(n,t){if(null==n)throw new Error("Argument contains array with empty element at index "+t);if(null==n.getType)throw new Error("Argument contains array with invalid element at index "+t+', it should be an action-creator instance from "typesafe-actions"')}function o(n){return"string"==typeof n||"symbol"==typeof n}function u(n){return!o(n)}function a(n){throw void 0===n&&(n=1),new Error("Argument "+n+" is invalid, it should be an action type of type: string | symbol")}function c(n,t){if(null==n)throw new Error("Argument contains array with empty element at index "+t);if("string"!=typeof n&&"symbol"!=typeof n)throw new Error("Argument contains array with invalid element at index "+t+", it should be of type: string | symbol")}function f(r,i,o,a){return n(r)&&t(1),u(r)&&e(1),{type:r,payload:i,meta:o,error:a}}function s(n,t){var r=null==t?function(){return f(n)}:t(f.bind(null,n));return Object.assign(r,{getType:function(){return n},toString:function(){return n}})}function y(r,e){n(r)&&t(1),u(r)&&a(1);var i=null!=e?e(r):function(){return{type:r}};return Object.assign(i,{getType:function(){return r},toString:function(){return r}})}function l(r){return n(r)&&t(1),u(r)&&a(1),Object.assign(function(){return y(r,function(n){return function(t,r){return{type:n,payload:t,meta:r}}})},{map:function(n){return y(r,function(t){return function(r,e){return Object.assign(n(r,e),{type:t})}})}})}function p(n,t,r,e){[n,t,r].forEach(c);return Object.assign(function(){return{request:l(n)(),success:l(t)(),failure:l(r)(),cancel:e&&l(e)()}},{})}function g(i){return n(i)&&t(1),r(i)||e(1),i.getType()}function d(n,t){void 0===t&&(t={});var e=Object.assign({},t);return Object.assign(function(t,r){if(void 0===t&&(t=n),e.hasOwnProperty(r.type)){var i=e[r.type];if("function"!=typeof i)throw Error('Reducer under "'+r.type+'" key is not a valid reducer');return i(t,r)}return t},{handlers:Object.assign({},e),handleAction:function(t,i){var u=Array.isArray(t)?t:[t],a={};return u.map(function(n){return r(n)?g(n):o(n)?n:function(n){throw void 0===n&&(n=1),new Error("Argument "+n+' is invalid, it should be an action-creator instance from "typesafe-actions" or action type of type: string | symbol')}()}).forEach(function(n){return a[n]=i}),d(n,Object.assign({},e,a))}})}function m(r,e){n(r)&&t(1);var i=Array.isArray(r)?r:[r];i.forEach(c);var o=function(n){return i.includes(n.type)};return void 0===e?o:o(e)}function h(r,e){n(r)&&t(1);var o=Array.isArray(r)?r:[r];o.forEach(i);var u=function(n){return o.some(function(t){return n.type===t.getType()})};return void 0===e?u:u(e)}function w(n,t){var r;if(null!=t){if("function"!=typeof t)throw new Error("second argument is not a function");r=t}else r=function(){return{type:n}};if(null==n)throw new Error("first argument is missing");if("string"!=typeof n&&"symbol"!=typeof n)throw new Error("first argument should be type of: string | symbol");return r}export{f as action,s as createAction,w as createActionDeprecated,p as createAsyncAction,y as createCustomAction,d as createReducer,l as createStandardAction,g as getType,h as isActionOf,m as isOfType};
//# sourceMappingURL=typesafe-actions.es.production.js.map

@@ -8,5 +8,2 @@ (function (global, factory) {

function checkIsEmpty(arg, argPosition) {
if (argPosition === void 0) {
argPosition = 1;
}

@@ -13,0 +10,0 @@ return arg == null;

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

!function(n,t){"object"==typeof exports&&"undefined"!=typeof module?t(exports):"function"==typeof define&&define.amd?define(["exports"],t):t((n=n||self).TypesafeActions={})}(this,function(n){"use strict";function t(n,t){return void 0===t&&(t=1),null==n}function r(n){throw void 0===n&&(n=1),new Error("Argument "+n+" is empty.")}function e(n){return"function"==typeof n&&"getType"in n}function i(n){throw void 0===n&&(n=1),new Error("Argument "+n+' is invalid, it should be an action-creator instance from "typesafe-actions"')}function o(n,t){if(null==n)throw new Error("Argument contains array with empty element at index "+t);if(null==n.getType)throw new Error("Argument contains array with invalid element at index "+t+', it should be an action-creator instance from "typesafe-actions"')}function u(n){return"string"==typeof n||"symbol"==typeof n}function c(n){return!u(n)}function a(n){throw void 0===n&&(n=1),new Error("Argument "+n+" is invalid, it should be an action type of type: string | symbol")}function f(n,t){if(null==n)throw new Error("Argument contains array with empty element at index "+t);if("string"!=typeof n&&"symbol"!=typeof n)throw new Error("Argument contains array with invalid element at index "+t+", it should be of type: string | symbol")}function s(n,e,o,u){return t(n)&&r(1),c(n)&&i(1),{type:n,payload:e,meta:o,error:u}}function y(n,e){t(n)&&r(1),c(n)&&a(1);var i=null!=e?e(n):function(){return{type:n}};return Object.assign(i,{getType:function(){return n},toString:function(){return n}})}function p(n){return t(n)&&r(1),c(n)&&a(1),Object.assign(function(){return y(n,function(n){return function(t,r){return{type:n,payload:t,meta:r}}})},{map:function(t){return y(n,function(n){return function(r,e){return Object.assign(t(r,e),{type:n})}})}})}function l(n){return t(n)&&r(1),e(n)||i(1),n.getType()}n.action=s,n.createAction=function(n,t){var r=null==t?function(){return s(n)}:t(s.bind(null,n));return Object.assign(r,{getType:function(){return n},toString:function(){return n}})},n.createActionDeprecated=function(n,t){var r;if(null!=t){if("function"!=typeof t)throw new Error("second argument is not a function");r=t}else r=function(){return{type:n}};if(null==n)throw new Error("first argument is missing");if("string"!=typeof n&&"symbol"!=typeof n)throw new Error("first argument should be type of: string | symbol");return r},n.createAsyncAction=function(n,t,r,e){return[n,t,r].forEach(f),Object.assign(function(){return{request:p(n)(),success:p(t)(),failure:p(r)(),cancel:e&&p(e)()}},{})},n.createCustomAction=y,n.createReducer=function n(t,r){void 0===r&&(r={});var i=Object.assign({},r);return Object.assign(function(n,r){if(void 0===n&&(n=t),i.hasOwnProperty(r.type)){var e=i[r.type];if("function"!=typeof e)throw Error('Reducer under "'+r.type+'" key is not a valid reducer');return e(n,r)}return n},{handlers:Object.assign({},i),handleAction:function(r,o){var c=Array.isArray(r)?r:[r],a={};return c.map(function(n){return e(n)?l(n):u(n)?n:function(n){throw void 0===n&&(n=1),new Error("Argument "+n+' is invalid, it should be an action-creator instance from "typesafe-actions" or action type of type: string | symbol')}()}).forEach(function(n){return a[n]=o}),n(t,Object.assign({},i,a))}})},n.createStandardAction=p,n.getType=l,n.isActionOf=function(n,e){t(n)&&r(1);var i=Array.isArray(n)?n:[n];i.forEach(o);var u=function(n){return i.some(function(t){return n.type===t.getType()})};return void 0===e?u:u(e)},n.isOfType=function(n,e){t(n)&&r(1);var i=Array.isArray(n)?n:[n];i.forEach(f);var o=function(n){return i.includes(n.type)};return void 0===e?o:o(e)}});
!function(n,t){"object"==typeof exports&&"undefined"!=typeof module?t(exports):"function"==typeof define&&define.amd?define(["exports"],t):t((n=n||self).TypesafeActions={})}(this,function(n){"use strict";function t(n,t){return null==n}function r(n){throw void 0===n&&(n=1),new Error("Argument "+n+" is empty.")}function e(n){return"function"==typeof n&&"getType"in n}function i(n){throw void 0===n&&(n=1),new Error("Argument "+n+' is invalid, it should be an action-creator instance from "typesafe-actions"')}function o(n,t){if(null==n)throw new Error("Argument contains array with empty element at index "+t);if(null==n.getType)throw new Error("Argument contains array with invalid element at index "+t+', it should be an action-creator instance from "typesafe-actions"')}function u(n){return"string"==typeof n||"symbol"==typeof n}function c(n){return!u(n)}function a(n){throw void 0===n&&(n=1),new Error("Argument "+n+" is invalid, it should be an action type of type: string | symbol")}function f(n,t){if(null==n)throw new Error("Argument contains array with empty element at index "+t);if("string"!=typeof n&&"symbol"!=typeof n)throw new Error("Argument contains array with invalid element at index "+t+", it should be of type: string | symbol")}function s(n,e,o,u){return t(n)&&r(1),c(n)&&i(1),{type:n,payload:e,meta:o,error:u}}function y(n,e){t(n)&&r(1),c(n)&&a(1);var i=null!=e?e(n):function(){return{type:n}};return Object.assign(i,{getType:function(){return n},toString:function(){return n}})}function p(n){return t(n)&&r(1),c(n)&&a(1),Object.assign(function(){return y(n,function(n){return function(t,r){return{type:n,payload:t,meta:r}}})},{map:function(t){return y(n,function(n){return function(r,e){return Object.assign(t(r,e),{type:n})}})}})}function l(n){return t(n)&&r(1),e(n)||i(1),n.getType()}n.action=s,n.createAction=function(n,t){var r=null==t?function(){return s(n)}:t(s.bind(null,n));return Object.assign(r,{getType:function(){return n},toString:function(){return n}})},n.createActionDeprecated=function(n,t){var r;if(null!=t){if("function"!=typeof t)throw new Error("second argument is not a function");r=t}else r=function(){return{type:n}};if(null==n)throw new Error("first argument is missing");if("string"!=typeof n&&"symbol"!=typeof n)throw new Error("first argument should be type of: string | symbol");return r},n.createAsyncAction=function(n,t,r,e){return[n,t,r].forEach(f),Object.assign(function(){return{request:p(n)(),success:p(t)(),failure:p(r)(),cancel:e&&p(e)()}},{})},n.createCustomAction=y,n.createReducer=function n(t,r){void 0===r&&(r={});var i=Object.assign({},r);return Object.assign(function(n,r){if(void 0===n&&(n=t),i.hasOwnProperty(r.type)){var e=i[r.type];if("function"!=typeof e)throw Error('Reducer under "'+r.type+'" key is not a valid reducer');return e(n,r)}return n},{handlers:Object.assign({},i),handleAction:function(r,o){var c=Array.isArray(r)?r:[r],a={};return c.map(function(n){return e(n)?l(n):u(n)?n:function(n){throw void 0===n&&(n=1),new Error("Argument "+n+' is invalid, it should be an action-creator instance from "typesafe-actions" or action type of type: string | symbol')}()}).forEach(function(n){return a[n]=o}),n(t,Object.assign({},i,a))}})},n.createStandardAction=p,n.getType=l,n.isActionOf=function(n,e){t(n)&&r(1);var i=Array.isArray(n)?n:[n];i.forEach(o);var u=function(n){return i.some(function(t){return n.type===t.getType()})};return void 0===e?u:u(e)},n.isOfType=function(n,e){t(n)&&r(1);var i=Array.isArray(n)?n:[n];i.forEach(f);var o=function(n){return i.includes(n.type)};return void 0===e?o:o(e)}});
//# sourceMappingURL=typesafe-actions.umd.production.js.map
{
"name": "typesafe-actions",
"version": "4.4.0",
"version": "4.4.1",
"description": "Typesafe Action Creators for Redux / Flux Architectures (in TypeScript)",

@@ -36,3 +36,6 @@ "author": "Piotr Witek <piotrek.witek@gmail.com> (http://piotrwitek.github.io)",

"postbuild": "rm -rf out",
"prepublishOnly": "npm run reinstall && npm run ci-check && npm run build"
"prepublishOnly": "npm run reinstall && npm run ci-check && npm run build",
"benchmark:2": "rm -rf out && node --max-old-space-size=8000 ./node_modules/typescript/lib/tsc.js --diagnostics --outDir out benchmarks/2-actions.ts",
"benchmark:10": "rm -rf out && node --max-old-space-size=8000 ./node_modules/typescript/lib/tsc.js --diagnostics --outDir out benchmarks/10-actions.ts",
"benchmark:50": "rm -rf out && node --max-old-space-size=8000 ./node_modules/typescript/lib/tsc.js --diagnostics --outDir out benchmarks/50-actions.ts"
},

@@ -46,20 +49,20 @@ "dependencies": {},

"babel-plugin-dev-expression": "0.2.1",
"core-js": "3.1.1",
"core-js": "3.1.3",
"doctoc": "1.4.0",
"dts-jest": "22.0.4",
"husky": "2.3.0",
"husky": "2.4.1",
"jest": "21.2.1",
"prettier": "1.17.1",
"rollup": "1.12.3",
"prettier": "1.18.2",
"rollup": "1.15.4",
"rollup-plugin-babel": "4.3.2",
"rollup-plugin-commonjs": "10.0.0",
"rollup-plugin-json": "4.0.0",
"rollup-plugin-node-resolve": "5.0.0",
"rollup-plugin-node-resolve": "5.0.2",
"rollup-plugin-replace": "2.2.0",
"rollup-plugin-size-snapshot": "0.8.0",
"rollup-plugin-size-snapshot": "0.9.0",
"rollup-plugin-sourcemaps": "0.4.2",
"rollup-plugin-terser": "4.0.4",
"rollup-plugin-terser": "5.0.0",
"ts-jest": "21.2.4",
"tslint": "5.16.0",
"typescript": "3.4.5"
"tslint": "5.17.0",
"typescript": "3.5.2"
},

@@ -66,0 +69,0 @@ "keywords": [

@@ -146,3 +146,3 @@ <div align="center">

For older browsers (e.g. IE <= 11) and mobile devices you need to provide these polyfills:
For older browsers support (e.g. IE <= 11) and some mobile devices you need to provide the following polyfills:
- [Object.assign](https://developer.mozilla.org/pl/docs/Web/JavaScript/Referencje/Obiekty/Object/assign#Polyfill)

@@ -153,7 +153,6 @@ - [Array.prototype.includes](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array/includes)

To provide the best compatibility for your application please include a popular polyfill package in your bundled application, such as `@babel/polyfill`.
You can check the `React` guidelines on how to do that, specifically: https://reactjs.org/docs/javascript-environment-requirements.html
To provide the best compatibility please include a popular polyfill package in your application, such as `core-js` or `react-app-polyfill` for `create-react-app`.
Please check the `React` guidelines to learn how to do that: [LINK](https://reactjs.org/docs/javascript-environment-requirements.html)
A polyfill fo IE11 is included in our `/codesandbox` application.
It's included in our `/codesandbox` reference implementation which is using `@babel/polyfill` and is confirmed to be working with IE11. Please check it out!
[⇧ back to top](#table-of-contents)

@@ -300,3 +299,3 @@

Now I wan't to show you **action-helpers** and explain their use-cases. We're going to implement a side-effect responsible for showing a success toast when user adds a new todo.
Now I want to show you **action-helpers** and explain their use-cases. We're going to implement a side-effect responsible for showing a success toast when user adds a new todo.

@@ -303,0 +302,0 @@ Important thing to notice is that all these helpers are acting as a **type-guard** so they'll narrow **tagged union type** (`RootAction`) to a specific action type that we want.

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

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc