typesafe-actions
Advanced tools
Comparing version 5.1.0-0 to 5.1.0-1
'use strict'; | ||
var action$1 = require('./action'); | ||
var validation = require('./utils/validation'); | ||
function checkIsEmpty(arg) { | ||
@@ -247,4 +244,4 @@ return arg == null; | ||
var actionCreator = createHandler == null ? function () { | ||
return action$1.action(type); | ||
} : createHandler(action$1.action.bind(null, type)); | ||
return action(type); | ||
} : createHandler(action.bind(null, type)); | ||
return Object.assign(actionCreator, { | ||
@@ -261,8 +258,8 @@ getType: function getType() { | ||
function createCustomAction$1(type, createHandler) { | ||
if (validation.checkIsEmpty(type)) { | ||
validation.throwIsEmpty(1); | ||
if (checkIsEmpty(type)) { | ||
throwIsEmpty(1); | ||
} | ||
if (validation.checkInvalidActionType(type)) { | ||
validation.throwInvalidActionType(1); | ||
if (checkInvalidActionType(type)) { | ||
throwInvalidActionType(1); | ||
} | ||
@@ -286,8 +283,8 @@ | ||
function createStandardAction(type) { | ||
if (validation.checkIsEmpty(type)) { | ||
validation.throwIsEmpty(1); | ||
if (checkIsEmpty(type)) { | ||
throwIsEmpty(1); | ||
} | ||
if (validation.checkInvalidActionType(type)) { | ||
validation.throwInvalidActionType(1); | ||
if (checkInvalidActionType(type)) { | ||
throwInvalidActionType(1); | ||
} | ||
@@ -294,0 +291,0 @@ |
@@ -1,2 +0,2 @@ | ||
"use strict";var n=require("./action"),t=require("./utils/validation");function r(n){return null==n}function e(n){throw new Error("Argument "+n+" is empty.")}function i(n){return"function"==typeof n&&"getType"in n}function o(n){throw new Error("Argument "+n+' is invalid, it should be an action-creator instance from "typesafe-actions"')}function u(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 c(n){return"string"==typeof n||"symbol"==typeof n}function a(n){return!c(n)}function s(n){throw 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 y(n,t){r(n)&&e(1),a(n)&&s(1);return Object.assign((function(){var r=null!=t?t.apply(void 0,arguments):void 0;return Object.assign({type:n},r)}),{getType:function(){return n},toString:function(){return n}})}function p(n,t,i){return r(n)&&e(1),a(n)&&s(1),function(){return y(n,(function(){var n=arguments.length<=0?void 0:arguments[0],r=arguments.length<=1?void 0:arguments[1];return null==t&&null==i||(n=null!=t?t.apply(void 0,arguments):void 0,r=null!=i?i.apply(void 0,arguments):void 0),Object.assign({},void 0!==n&&{payload:n},{},void 0!==r&&{meta:r})}))}}function l(n){return r(n)&&e(1),i(n)||o(1),n.getType()}function d(n,r){t.checkIsEmpty(n)&&t.throwIsEmpty(1),t.checkInvalidActionType(n)&&t.throwInvalidActionType(1);var e=null!=r?r(n):function(){return{type:n}};return Object.assign(e,{getType:function(){return n},toString:function(){return n}})}var g={createAction:function(t,r){var e=null==r?function(){return n.action(t)}:r(n.action.bind(null,t));return Object.assign(e,{getType:function(){return t},toString:function(){return t}})},createCustomAction:d,createStandardAction:function(n){return t.checkIsEmpty(n)&&t.throwIsEmpty(1),t.checkInvalidActionType(n)&&t.throwInvalidActionType(1),Object.assign((function(){return d(n,(function(n){return function(t,r){return{type:n,payload:t,meta:r}}}))}),{map:function(t){return d(n,(function(n){return function(r,e){return Object.assign(t(r,e),{type:n})}}))}})}};exports.action=function(n,t,i,u){return r(n)&&e(1),a(n)&&o(1),{type:n,payload:t,meta:i,error:u}},exports.createAction=p,exports.createAsyncAction=function(n,t,r,e){return function(){var i=[n,t,r,e].map((function(n,t){return Array.isArray(n)?p(n[0],n[1],n[2])():"string"==typeof n||"symbol"==typeof n?p(n)():void(t<3&&function(n){throw new Error("Argument "+n+' is invalid, it should be an action type of "string | symbol" or a tuple of "[string | symbol, Function, Function?]"')}(t))}));return{request:i[0],success:i[1],failure:i[2],cancel:i[3]}}},exports.createCustomAction=y,exports.createReducer=function n(t,r){void 0===r&&(r={});var e=Object.assign({},r),o=function(r,o){var u=Array.isArray(r)?r:[r],a={};return u.map((function(n,t){return i(n)?l(n):c(n)?n:function(n){throw new Error("Argument "+n+' is invalid, it should be an action-creator instance from "typesafe-actions" or action type of type: string | symbol')}(t+1)})).forEach((function(n){return a[n]=o})),n(t,Object.assign({},e,{},a))};return Object.assign((function(n,r){if(void 0===n&&(n=t),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(n,r)}return n}),{handlers:Object.assign({},e),handleAction:o,handleType:o})},exports.deprecated=g,exports.getType=l,exports.isActionOf=function(n,t){r(n)&&e(1);var i=Array.isArray(n)?n:[n];i.forEach(u);var o=function(n){return i.some((function(t){return n.type===t.getType()}))};return void 0===t?o:o(t)},exports.isOfType=function(n,t){r(n)&&e(1);var i=Array.isArray(n)?n:[n];i.forEach(f);var o=function(n){return i.includes(n.type)};return void 0===t?o:o(t)}; | ||
"use strict";function n(n){return null==n}function t(n){throw new Error("Argument "+n+" is empty.")}function r(n){return"function"==typeof n&&"getType"in n}function e(n){throw 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 a(n){throw 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 s(r,o,i,a){return n(r)&&t(1),u(r)&&e(1),{type:r,payload:o,meta:i,error:a}}function f(r,e){n(r)&&t(1),u(r)&&a(1);return Object.assign((function(){var n=null!=e?e.apply(void 0,arguments):void 0;return Object.assign({type:r},n)}),{getType:function(){return r},toString:function(){return r}})}function y(r,e,o){return n(r)&&t(1),u(r)&&a(1),function(){return f(r,(function(){var n=arguments.length<=0?void 0:arguments[0],t=arguments.length<=1?void 0:arguments[1];return null==e&&null==o||(n=null!=e?e.apply(void 0,arguments):void 0,t=null!=o?o.apply(void 0,arguments):void 0),Object.assign({},void 0!==n&&{payload:n},{},void 0!==t&&{meta:t})}))}}function l(o){return n(o)&&t(1),r(o)||e(1),o.getType()}function p(r,e){n(r)&&t(1),u(r)&&a(1);var o=null!=e?e(r):function(){return{type:r}};return Object.assign(o,{getType:function(){return r},toString:function(){return r}})}var d={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}})},createCustomAction:p,createStandardAction:function(r){return n(r)&&t(1),u(r)&&a(1),Object.assign((function(){return p(r,(function(n){return function(t,r){return{type:n,payload:t,meta:r}}}))}),{map:function(n){return p(r,(function(t){return function(r,e){return Object.assign(n(r,e),{type:t})}}))}})}};exports.action=s,exports.createAction=y,exports.createAsyncAction=function(n,t,r,e){return function(){var o=[n,t,r,e].map((function(n,t){return Array.isArray(n)?y(n[0],n[1],n[2])():"string"==typeof n||"symbol"==typeof n?y(n)():void(t<3&&function(n){throw new Error("Argument "+n+' is invalid, it should be an action type of "string | symbol" or a tuple of "[string | symbol, Function, Function?]"')}(t))}));return{request:o[0],success:o[1],failure:o[2],cancel:o[3]}}},exports.createCustomAction=f,exports.createReducer=function n(t,e){void 0===e&&(e={});var o=Object.assign({},e),u=function(e,u){var a=Array.isArray(e)?e:[e],c={};return a.map((function(n,t){return r(n)?l(n):i(n)?n:function(n){throw new Error("Argument "+n+' is invalid, it should be an action-creator instance from "typesafe-actions" or action type of type: string | symbol')}(t+1)})).forEach((function(n){return c[n]=u})),n(t,Object.assign({},o,{},c))};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:u,handleType:u})},exports.deprecated=d,exports.getType=l,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(c);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 @@ | ||
import{action as n}from"./action";import{checkIsEmpty as t,throwIsEmpty as r,checkInvalidActionType as e,throwInvalidActionType as i}from"./utils/validation";function o(n){return null==n}function u(n){throw new Error("Argument "+n+" is empty.")}function a(n){return"function"==typeof n&&"getType"in n}function c(n){throw new Error("Argument "+n+' is invalid, it should be an action-creator instance from "typesafe-actions"')}function s(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 f(n){return"string"==typeof n||"symbol"==typeof n}function y(n){return!f(n)}function l(n){throw new Error("Argument "+n+" is invalid, it should be an action type of type: string | symbol")}function p(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 d(n,t,r,e){return o(n)&&u(1),y(n)&&c(1),{type:n,payload:t,meta:r,error:e}}function m(n,t){o(n)&&u(1),y(n)&&l(1);return Object.assign((function(){var r=null!=t?t.apply(void 0,arguments):void 0;return Object.assign({type:n},r)}),{getType:function(){return n},toString:function(){return n}})}function g(n,t,r){return o(n)&&u(1),y(n)&&l(1),function(){return m(n,(function(){var n=arguments.length<=0?void 0:arguments[0],e=arguments.length<=1?void 0:arguments[1];return null==t&&null==r||(n=null!=t?t.apply(void 0,arguments):void 0,e=null!=r?r.apply(void 0,arguments):void 0),Object.assign({},void 0!==n&&{payload:n},{},void 0!==e&&{meta:e})}))}}function v(n,t,r,e){return function(){var i=[n,t,r,e].map((function(n,t){return Array.isArray(n)?g(n[0],n[1],n[2])():"string"==typeof n||"symbol"==typeof n?g(n)():void(t<3&&function(n){throw new Error("Argument "+n+' is invalid, it should be an action type of "string | symbol" or a tuple of "[string | symbol, Function, Function?]"')}(t))}));return{request:i[0],success:i[1],failure:i[2],cancel:i[3]}}}function h(n){return o(n)&&u(1),a(n)||c(1),n.getType()}function b(n,t){void 0===t&&(t={});var r=Object.assign({},t),e=function(t,e){var i=Array.isArray(t)?t:[t],o={};return i.map((function(n,t){return a(n)?h(n):f(n)?n:function(n){throw new Error("Argument "+n+' is invalid, it should be an action-creator instance from "typesafe-actions" or action type of type: string | symbol')}(t+1)})).forEach((function(n){return o[n]=e})),b(n,Object.assign({},r,{},o))};return Object.assign((function(t,e){if(void 0===t&&(t=n),r.hasOwnProperty(e.type)){var i=r[e.type];if("function"!=typeof i)throw Error('Reducer under "'+e.type+'" key is not a valid reducer');return i(t,e)}return t}),{handlers:Object.assign({},r),handleAction:e,handleType:e})}function w(n,t){o(n)&&u(1);var r=Array.isArray(n)?n:[n];r.forEach(p);var e=function(n){return r.includes(n.type)};return void 0===t?e:e(t)}function A(n,t){o(n)&&u(1);var r=Array.isArray(n)?n:[n];r.forEach(s);var e=function(n){return r.some((function(t){return n.type===t.getType()}))};return void 0===t?e:e(t)}function E(n,o){t(n)&&r(1),e(n)&&i(1);var u=null!=o?o(n):function(){return{type:n}};return Object.assign(u,{getType:function(){return n},toString:function(){return n}})}var O={createAction:function(t,r){var e=null==r?function(){return n(t)}:r(n.bind(null,t));return Object.assign(e,{getType:function(){return t},toString:function(){return t}})},createCustomAction:E,createStandardAction:function(n){return t(n)&&r(1),e(n)&&i(1),Object.assign((function(){return E(n,(function(n){return function(t,r){return{type:n,payload:t,meta:r}}}))}),{map:function(t){return E(n,(function(n){return function(r,e){return Object.assign(t(r,e),{type:n})}}))}})}};export{d as action,g as createAction,v as createAsyncAction,m as createCustomAction,b as createReducer,O as deprecated,h as getType,A as isActionOf,w as isOfType}; | ||
function n(n){return null==n}function t(n){throw new Error("Argument "+n+" is empty.")}function r(n){return"function"==typeof n&&"getType"in n}function e(n){throw 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 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(r,e){n(r)&&t(1),u(r)&&a(1);return Object.assign((function(){var n=null!=e?e.apply(void 0,arguments):void 0;return Object.assign({type:r},n)}),{getType:function(){return r},toString:function(){return r}})}function y(r,e,i){return n(r)&&t(1),u(r)&&a(1),function(){return s(r,(function(){var n=arguments.length<=0?void 0:arguments[0],t=arguments.length<=1?void 0:arguments[1];return null==e&&null==i||(n=null!=e?e.apply(void 0,arguments):void 0,t=null!=i?i.apply(void 0,arguments):void 0),Object.assign({},void 0!==n&&{payload:n},{},void 0!==t&&{meta:t})}))}}function l(n,t,r,e){return function(){var i=[n,t,r,e].map((function(n,t){return Array.isArray(n)?y(n[0],n[1],n[2])():"string"==typeof n||"symbol"==typeof n?y(n)():void(t<3&&function(n){throw new Error("Argument "+n+' is invalid, it should be an action type of "string | symbol" or a tuple of "[string | symbol, Function, Function?]"')}(t))}));return{request:i[0],success:i[1],failure:i[2],cancel:i[3]}}}function p(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),i=function(t,i){var u=Array.isArray(t)?t:[t],a={};return u.map((function(n,t){return r(n)?p(n):o(n)?n:function(n){throw new Error("Argument "+n+' is invalid, it should be an action-creator instance from "typesafe-actions" or action type of type: string | symbol')}(t+1)})).forEach((function(n){return a[n]=i})),d(n,Object.assign({},e,{},a))};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:i,handleType:i})}function g(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 m(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 v(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}})}var h={createAction:function(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}})},createCustomAction:v,createStandardAction:function(r){return n(r)&&t(1),u(r)&&a(1),Object.assign((function(){return v(r,(function(n){return function(t,r){return{type:n,payload:t,meta:r}}}))}),{map:function(n){return v(r,(function(t){return function(r,e){return Object.assign(n(r,e),{type:t})}}))}})}};export{f as action,y as createAction,l as createAsyncAction,s as createCustomAction,d as createReducer,h as deprecated,p as getType,m as isActionOf,g as isOfType}; | ||
//# sourceMappingURL=typesafe-actions.es.production.js.map |
(function (global, factory) { | ||
typeof exports === 'object' && typeof module !== 'undefined' ? factory(exports, require('./action'), require('./utils/validation')) : | ||
typeof define === 'function' && define.amd ? define(['exports', './action', './utils/validation'], factory) : | ||
(global = global || self, factory(global.TypesafeActions = {}, global.action$1, global.validation)); | ||
}(this, function (exports, action$1, validation) { 'use strict'; | ||
typeof exports === 'object' && typeof module !== 'undefined' ? factory(exports) : | ||
typeof define === 'function' && define.amd ? define(['exports'], factory) : | ||
(global = global || self, factory(global.TypesafeActions = {})); | ||
}(this, function (exports) { 'use strict'; | ||
@@ -248,4 +248,4 @@ function checkIsEmpty(arg) { | ||
var actionCreator = createHandler == null ? function () { | ||
return action$1.action(type); | ||
} : createHandler(action$1.action.bind(null, type)); | ||
return action(type); | ||
} : createHandler(action.bind(null, type)); | ||
return Object.assign(actionCreator, { | ||
@@ -262,8 +262,8 @@ getType: function getType() { | ||
function createCustomAction$1(type, createHandler) { | ||
if (validation.checkIsEmpty(type)) { | ||
validation.throwIsEmpty(1); | ||
if (checkIsEmpty(type)) { | ||
throwIsEmpty(1); | ||
} | ||
if (validation.checkInvalidActionType(type)) { | ||
validation.throwInvalidActionType(1); | ||
if (checkInvalidActionType(type)) { | ||
throwInvalidActionType(1); | ||
} | ||
@@ -287,8 +287,8 @@ | ||
function createStandardAction(type) { | ||
if (validation.checkIsEmpty(type)) { | ||
validation.throwIsEmpty(1); | ||
if (checkIsEmpty(type)) { | ||
throwIsEmpty(1); | ||
} | ||
if (validation.checkInvalidActionType(type)) { | ||
validation.throwInvalidActionType(1); | ||
if (checkInvalidActionType(type)) { | ||
throwInvalidActionType(1); | ||
} | ||
@@ -295,0 +295,0 @@ |
@@ -1,2 +0,2 @@ | ||
!function(n,t){"object"==typeof exports&&"undefined"!=typeof module?t(exports,require("./action"),require("./utils/validation")):"function"==typeof define&&define.amd?define(["exports","./action","./utils/validation"],t):t((n=n||self).TypesafeActions={},n.action$1,n.validation)}(this,(function(n,t,r){"use strict";function e(n){return null==n}function i(n){throw new Error("Argument "+n+" is empty.")}function o(n){return"function"==typeof n&&"getType"in n}function u(n){throw new Error("Argument "+n+' is invalid, it should be an action-creator instance from "typesafe-actions"')}function c(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 a(n){return"string"==typeof n||"symbol"==typeof n}function s(n){return!a(n)}function f(n){throw new Error("Argument "+n+" is invalid, it should be an action type of type: string | symbol")}function y(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 l(n,t){e(n)&&i(1),s(n)&&f(1);return Object.assign((function(){var r=null!=t?t.apply(void 0,arguments):void 0;return Object.assign({type:n},r)}),{getType:function(){return n},toString:function(){return n}})}function p(n,t,r){return e(n)&&i(1),s(n)&&f(1),function(){return l(n,(function(){var n=arguments.length<=0?void 0:arguments[0],e=arguments.length<=1?void 0:arguments[1];return null==t&&null==r||(n=null!=t?t.apply(void 0,arguments):void 0,e=null!=r?r.apply(void 0,arguments):void 0),Object.assign({},void 0!==n&&{payload:n},{},void 0!==e&&{meta:e})}))}}function d(n){return e(n)&&i(1),o(n)||u(1),n.getType()}function m(n,t){r.checkIsEmpty(n)&&r.throwIsEmpty(1),r.checkInvalidActionType(n)&&r.throwInvalidActionType(1);var e=null!=t?t(n):function(){return{type:n}};return Object.assign(e,{getType:function(){return n},toString:function(){return n}})}var v={createAction:function(n,r){var e=null==r?function(){return t.action(n)}:r(t.action.bind(null,n));return Object.assign(e,{getType:function(){return n},toString:function(){return n}})},createCustomAction:m,createStandardAction:function(n){return r.checkIsEmpty(n)&&r.throwIsEmpty(1),r.checkInvalidActionType(n)&&r.throwInvalidActionType(1),Object.assign((function(){return m(n,(function(n){return function(t,r){return{type:n,payload:t,meta:r}}}))}),{map:function(t){return m(n,(function(n){return function(r,e){return Object.assign(t(r,e),{type:n})}}))}})}};n.action=function(n,t,r,o){return e(n)&&i(1),s(n)&&u(1),{type:n,payload:t,meta:r,error:o}},n.createAction=p,n.createAsyncAction=function(n,t,r,e){return function(){var i=[n,t,r,e].map((function(n,t){return Array.isArray(n)?p(n[0],n[1],n[2])():"string"==typeof n||"symbol"==typeof n?p(n)():void(t<3&&function(n){throw new Error("Argument "+n+' is invalid, it should be an action type of "string | symbol" or a tuple of "[string | symbol, Function, Function?]"')}(t))}));return{request:i[0],success:i[1],failure:i[2],cancel:i[3]}}},n.createCustomAction=l,n.createReducer=function n(t,r){void 0===r&&(r={});var e=Object.assign({},r),i=function(r,i){var u=Array.isArray(r)?r:[r],c={};return u.map((function(n,t){return o(n)?d(n):a(n)?n:function(n){throw new Error("Argument "+n+' is invalid, it should be an action-creator instance from "typesafe-actions" or action type of type: string | symbol')}(t+1)})).forEach((function(n){return c[n]=i})),n(t,Object.assign({},e,{},c))};return Object.assign((function(n,r){if(void 0===n&&(n=t),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(n,r)}return n}),{handlers:Object.assign({},e),handleAction:i,handleType:i})},n.deprecated=v,n.getType=d,n.isActionOf=function(n,t){e(n)&&i(1);var r=Array.isArray(n)?n:[n];r.forEach(c);var o=function(n){return r.some((function(t){return n.type===t.getType()}))};return void 0===t?o:o(t)},n.isOfType=function(n,t){e(n)&&i(1);var r=Array.isArray(n)?n:[n];r.forEach(y);var o=function(n){return r.includes(n.type)};return void 0===t?o:o(t)}})); | ||
!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){return null==n}function r(n){throw new Error("Argument "+n+" is empty.")}function e(n){return"function"==typeof n&&"getType"in n}function i(n){throw 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 a(n){return!u(n)}function c(n){throw 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),a(n)&&i(1),{type:n,payload:e,meta:o,error:u}}function y(n,e){t(n)&&r(1),a(n)&&c(1);return Object.assign((function(){var t=null!=e?e.apply(void 0,arguments):void 0;return Object.assign({type:n},t)}),{getType:function(){return n},toString:function(){return n}})}function l(n,e,i){return t(n)&&r(1),a(n)&&c(1),function(){return y(n,(function(){var n=arguments.length<=0?void 0:arguments[0],t=arguments.length<=1?void 0:arguments[1];return null==e&&null==i||(n=null!=e?e.apply(void 0,arguments):void 0,t=null!=i?i.apply(void 0,arguments):void 0),Object.assign({},void 0!==n&&{payload:n},{},void 0!==t&&{meta:t})}))}}function p(n){return t(n)&&r(1),e(n)||i(1),n.getType()}function d(n,e){t(n)&&r(1),a(n)&&c(1);var i=null!=e?e(n):function(){return{type:n}};return Object.assign(i,{getType:function(){return n},toString:function(){return n}})}var g={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}})},createCustomAction:d,createStandardAction:function(n){return t(n)&&r(1),a(n)&&c(1),Object.assign((function(){return d(n,(function(n){return function(t,r){return{type:n,payload:t,meta:r}}}))}),{map:function(t){return d(n,(function(n){return function(r,e){return Object.assign(t(r,e),{type:n})}}))}})}};n.action=s,n.createAction=l,n.createAsyncAction=function(n,t,r,e){return function(){var i=[n,t,r,e].map((function(n,t){return Array.isArray(n)?l(n[0],n[1],n[2])():"string"==typeof n||"symbol"==typeof n?l(n)():void(t<3&&function(n){throw new Error("Argument "+n+' is invalid, it should be an action type of "string | symbol" or a tuple of "[string | symbol, Function, Function?]"')}(t))}));return{request:i[0],success:i[1],failure:i[2],cancel:i[3]}}},n.createCustomAction=y,n.createReducer=function n(t,r){void 0===r&&(r={});var i=Object.assign({},r),o=function(r,o){var a=Array.isArray(r)?r:[r],c={};return a.map((function(n,t){return e(n)?p(n):u(n)?n:function(n){throw new Error("Argument "+n+' is invalid, it should be an action-creator instance from "typesafe-actions" or action type of type: string | symbol')}(t+1)})).forEach((function(n){return c[n]=o})),n(t,Object.assign({},i,{},c))};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:o,handleType:o})},n.deprecated=g,n.getType=p,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": "5.1.0-0", | ||
"version": "5.1.0-1", | ||
"description": "Typesafe Action Creators for Redux / Flux Architectures (in TypeScript)", | ||
@@ -5,0 +5,0 @@ "author": "Piotr Witek <piotrek.witek@gmail.com> (http://piotrwitek.github.io)", |
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
Minified code
QualityThis package contains minified code. This may be harmless in some cases where minified code is included in packaged libraries, however packages on npm should not minify code.
Found 1 instance in 1 package
1
151356
924