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

redux-promise-middleware

Package Overview
Dependencies
Maintainers
1
Versions
49
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

redux-promise-middleware - npm Package Compare versions

Comparing version 4.2.1 to 4.3.0

46

dist/index.js

@@ -110,14 +110,21 @@ 'use strict';

/*
* @function handleReject
* @description Dispatch the rejected action and return
* an error object. The error object is the original error
* that was thrown. The user of the library is responsible for
* best practices in ensure that they are throwing an Error object.
* @params reason The reason the promise was rejected
* @function transformFulfill
* @description Transforms a fulfilled value into a success object.
* @returns {object}
*/
var transformFulfill = function transformFulfill() {
var value = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : null;
var resolvedAction = getAction(value, false);
return { value: value, action: resolvedAction };
};
/*
* @function handleReject
* @description Dispatch the rejected action.
* @returns {void}
*/
var handleReject = function handleReject(reason) {
var rejectedAction = getAction(reason, true);
dispatch(rejectedAction);
throw reason;
};

@@ -127,15 +134,8 @@

* @function handleFulfill
* @description Dispatch the fulfilled action and
* return the success object. The success object should
* contain the value and the dispatched action.
* @param value The value the promise was resloved with
* @returns {object}
* @description Dispatch the fulfilled action.
* @param successValue The value from transformFulfill
* @returns {void}
*/
var handleFulfill = function handleFulfill() {
var value = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : null;
var resolvedAction = getAction(value, false);
dispatch(resolvedAction);
return { value: value, action: resolvedAction };
var handleFulfill = function handleFulfill(successValue) {
dispatch(successValue.action);
};

@@ -172,3 +172,9 @@

*/
return promise.then(handleFulfill, handleReject);
var promiseValue = promise.then(transformFulfill);
var sideEffects = promiseValue.then(handleFulfill, handleReject);
return sideEffects.then(function () {
return promiseValue;
}, function () {
return promiseValue;
});
};

@@ -175,0 +181,0 @@ };

@@ -166,14 +166,21 @@ (function webpackUniversalModuleDefinition(root, factory) {

/*
* @function handleReject
* @description Dispatch the rejected action and return
* an error object. The error object is the original error
* that was thrown. The user of the library is responsible for
* best practices in ensure that they are throwing an Error object.
* @params reason The reason the promise was rejected
* @function transformFulfill
* @description Transforms a fulfilled value into a success object.
* @returns {object}
*/
var transformFulfill = function transformFulfill() {
var value = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : null;
var resolvedAction = getAction(value, false);
return { value: value, action: resolvedAction };
};
/*
* @function handleReject
* @description Dispatch the rejected action.
* @returns {void}
*/
var handleReject = function handleReject(reason) {
var rejectedAction = getAction(reason, true);
dispatch(rejectedAction);
throw reason;
};

@@ -183,15 +190,8 @@

* @function handleFulfill
* @description Dispatch the fulfilled action and
* return the success object. The success object should
* contain the value and the dispatched action.
* @param value The value the promise was resloved with
* @returns {object}
* @description Dispatch the fulfilled action.
* @param successValue The value from transformFulfill
* @returns {void}
*/
var handleFulfill = function handleFulfill() {
var value = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : null;
var resolvedAction = getAction(value, false);
dispatch(resolvedAction);
return { value: value, action: resolvedAction };
var handleFulfill = function handleFulfill(successValue) {
dispatch(successValue.action);
};

@@ -228,3 +228,9 @@

*/
return promise.then(handleFulfill, handleReject);
var promiseValue = promise.then(transformFulfill);
var sideEffects = promiseValue.then(handleFulfill, handleReject);
return sideEffects.then(function () {
return promiseValue;
}, function () {
return promiseValue;
});
};

@@ -231,0 +237,0 @@ };

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

!function(t,e){"object"==typeof exports&&"object"==typeof module?module.exports=e():"function"==typeof define&&define.amd?define([],e):"object"==typeof exports?exports.ReduxPromiseMiddleware=e():t.ReduxPromiseMiddleware=e()}(this,function(){return function(t){function e(r){if(o[r])return o[r].exports;var n=o[r]={exports:{},id:r,loaded:!1};return t[r].call(n.exports,n,n.exports,e),n.loaded=!0,n.exports}var o={};return e.m=t,e.c=o,e.p="",e(0)}([function(t,e,o){"use strict";function r(t){return t&&t.__esModule?t:{default:t}}function n(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},e=t.promiseTypeSuffixes||c;return function(t){var o=t.dispatch;return function(t){return function(r){if(!r.payload)return t(r);if(!(0,l.default)(r.payload)&&!(0,l.default)(r.payload.promise))return t(r);var n=r.type,a=r.payload,y=r.meta,d=f(e,3),p=d[0],c=d[1],s=d[2],v=function(t,e){return i({type:n+"_"+(e?s:c)},null===t||"undefined"==typeof t?{}:{payload:t},void 0!==y?{meta:y}:{},e?{error:!0}:{})},m=void 0,b=void 0;(0,l.default)(r.payload)||"object"!==u(r.payload)?(m=a,b=void 0):(m=a.promise,b=a.data),t(i({type:n+"_"+p},void 0!==b?{payload:b}:{},void 0!==y?{meta:y}:{}));var E=function(t){var e=v(t,!0);throw o(e),t},h=function(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:null,e=v(t,!1);return o(e),{value:t,action:e}};return m.then(h,E)}}}}Object.defineProperty(e,"__esModule",{value:!0}),e.REJECTED=e.FULFILLED=e.PENDING=void 0;var u="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},i=Object.assign||function(t){for(var e=1;e<arguments.length;e++){var o=arguments[e];for(var r in o)Object.prototype.hasOwnProperty.call(o,r)&&(t[r]=o[r])}return t},f=function(){function t(t,e){var o=[],r=!0,n=!1,u=void 0;try{for(var i,f=t[Symbol.iterator]();!(r=(i=f.next()).done)&&(o.push(i.value),!e||o.length!==e);r=!0);}catch(t){n=!0,u=t}finally{try{!r&&f.return&&f.return()}finally{if(n)throw u}}return o}return function(e,o){if(Array.isArray(e))return e;if(Symbol.iterator in Object(e))return t(e,o);throw new TypeError("Invalid attempt to destructure non-iterable instance")}}();e.default=n;var a=o(1),l=r(a),y=e.PENDING="PENDING",d=e.FULFILLED="FULFILLED",p=e.REJECTED="REJECTED",c=[y,d,p]},function(t,e){"use strict";function o(t){return null!==t&&"object"===("undefined"==typeof t?"undefined":r(t))&&(t&&"function"==typeof t.then)}Object.defineProperty(e,"__esModule",{value:!0});var r="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t};e.default=o}])});
!function(t,e){"object"==typeof exports&&"object"==typeof module?module.exports=e():"function"==typeof define&&define.amd?define([],e):"object"==typeof exports?exports.ReduxPromiseMiddleware=e():t.ReduxPromiseMiddleware=e()}(this,function(){return function(t){function e(n){if(o[n])return o[n].exports;var r=o[n]={exports:{},id:n,loaded:!1};return t[n].call(r.exports,r,r.exports,e),r.loaded=!0,r.exports}var o={};return e.m=t,e.c=o,e.p="",e(0)}([function(t,e,o){"use strict";function n(t){return t&&t.__esModule?t:{default:t}}function r(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},e=t.promiseTypeSuffixes||p;return function(t){var o=t.dispatch;return function(t){return function(n){if(!n.payload)return t(n);if(!(0,l.default)(n.payload)&&!(0,l.default)(n.payload.promise))return t(n);var r=n.type,a=n.payload,c=n.meta,y=f(e,3),d=y[0],p=y[1],s=y[2],v=function(t,e){return i({type:r+"_"+(e?s:p)},null===t||"undefined"==typeof t?{}:{payload:t},void 0!==c?{meta:c}:{},e?{error:!0}:{})},m=void 0,b=void 0;(0,l.default)(n.payload)||"object"!==u(n.payload)?(m=a,b=void 0):(m=a.promise,b=a.data),t(i({type:r+"_"+d},void 0!==b?{payload:b}:{},void 0!==c?{meta:c}:{}));var E=function(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:null,e=v(t,!1);return{value:t,action:e}},h=function(t){var e=v(t,!0);o(e)},x=function(t){o(t.action)},S=m.then(E),j=S.then(x,h);return j.then(function(){return S},function(){return S})}}}}Object.defineProperty(e,"__esModule",{value:!0}),e.REJECTED=e.FULFILLED=e.PENDING=void 0;var u="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},i=Object.assign||function(t){for(var e=1;e<arguments.length;e++){var o=arguments[e];for(var n in o)Object.prototype.hasOwnProperty.call(o,n)&&(t[n]=o[n])}return t},f=function(){function t(t,e){var o=[],n=!0,r=!1,u=void 0;try{for(var i,f=t[Symbol.iterator]();!(n=(i=f.next()).done)&&(o.push(i.value),!e||o.length!==e);n=!0);}catch(t){r=!0,u=t}finally{try{!n&&f.return&&f.return()}finally{if(r)throw u}}return o}return function(e,o){if(Array.isArray(e))return e;if(Symbol.iterator in Object(e))return t(e,o);throw new TypeError("Invalid attempt to destructure non-iterable instance")}}();e.default=r;var a=o(1),l=n(a),c=e.PENDING="PENDING",y=e.FULFILLED="FULFILLED",d=e.REJECTED="REJECTED",p=[c,y,d]},function(t,e){"use strict";function o(t){return null!==t&&"object"===("undefined"==typeof t?"undefined":n(t))&&(t&&"function"==typeof t.then)}Object.defineProperty(e,"__esModule",{value:!0});var n="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t};e.default=o}])});
{
"name": "redux-promise-middleware",
"version": "4.2.1",
"version": "4.3.0",
"description": "Redux middleware for handling promises and optimistic updates",

@@ -5,0 +5,0 @@ "main": "dist/index.js",

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