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.1.0 to 4.2.0

bin/test.sh

28

dist/index.js

@@ -7,3 +7,3 @@ 'use strict';

var _typeof = typeof Symbol === "function" && typeof Symbol.iterator === "symbol" ? function (obj) { return typeof obj; } : function (obj) { return obj && typeof Symbol === "function" && obj.constructor === Symbol ? "symbol" : typeof obj; };
var _typeof = typeof Symbol === "function" && typeof Symbol.iterator === "symbol" ? function (obj) { return typeof obj; } : function (obj) { return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; };

@@ -30,3 +30,3 @@ var _extends = Object.assign || function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; };

function promiseMiddleware() {
var config = arguments.length <= 0 || arguments[0] === undefined ? {} : arguments[0];
var config = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};

@@ -50,14 +50,13 @@ var promiseTypeSuffixes = config.promiseTypeSuffixes || defaultTypes;

// Deconstruct the properties of the original action object to constants
var type = action.type;
var payload = action.payload;
var meta = action.meta;
var type = action.type,
payload = action.payload,
meta = action.meta;
// Assign values for promise type suffixes
var _promiseTypeSuffixes = _slicedToArray(promiseTypeSuffixes, 3);
var _promiseTypeSuffixes = _slicedToArray(promiseTypeSuffixes, 3),
PENDING = _promiseTypeSuffixes[0],
FULFILLED = _promiseTypeSuffixes[1],
REJECTED = _promiseTypeSuffixes[2];
var PENDING = _promiseTypeSuffixes[0];
var FULFILLED = _promiseTypeSuffixes[1];
var REJECTED = _promiseTypeSuffixes[2];
/**

@@ -71,2 +70,3 @@ * @function getAction

var getAction = function getAction(newPayload, isRejected) {

@@ -77,3 +77,3 @@ return _extends({

payload: newPayload
}, !!meta ? { meta: meta } : {}, isRejected ? {
}, meta !== undefined ? { meta: meta } : {}, isRejected ? {
error: true

@@ -97,3 +97,3 @@ } : {});

promise = payload;
data = null;
data = undefined;
}

@@ -108,3 +108,3 @@

type: type + '_' + PENDING
}, !!data ? { payload: data } : {}, !!meta ? { meta: meta } : {}));
}, data !== undefined ? { payload: data } : {}, meta !== undefined ? { meta: meta } : {}));

@@ -135,3 +135,3 @@ /*

var handleFulfill = function handleFulfill() {
var value = arguments.length <= 0 || arguments[0] === undefined ? null : arguments[0];
var value = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : null;

@@ -138,0 +138,0 @@ var resolvedAction = getAction(value, false);

@@ -7,3 +7,3 @@ 'use strict';

var _typeof = typeof Symbol === "function" && typeof Symbol.iterator === "symbol" ? function (obj) { return typeof obj; } : function (obj) { return obj && typeof Symbol === "function" && obj.constructor === Symbol ? "symbol" : typeof obj; };
var _typeof = typeof Symbol === "function" && typeof Symbol.iterator === "symbol" ? function (obj) { return typeof obj; } : function (obj) { return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; };

@@ -10,0 +10,0 @@ exports.default = isPromise;

@@ -63,3 +63,3 @@ (function webpackUniversalModuleDefinition(root, factory) {

var _typeof = typeof Symbol === "function" && typeof Symbol.iterator === "symbol" ? function (obj) { return typeof obj; } : function (obj) { return obj && typeof Symbol === "function" && obj.constructor === Symbol ? "symbol" : typeof obj; };
var _typeof = typeof Symbol === "function" && typeof Symbol.iterator === "symbol" ? function (obj) { return typeof obj; } : function (obj) { return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; };

@@ -86,3 +86,3 @@ var _extends = Object.assign || function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; };

function promiseMiddleware() {
var config = arguments.length <= 0 || arguments[0] === undefined ? {} : arguments[0];
var config = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};

@@ -106,14 +106,13 @@ var promiseTypeSuffixes = config.promiseTypeSuffixes || defaultTypes;

// Deconstruct the properties of the original action object to constants
var type = action.type;
var payload = action.payload;
var meta = action.meta;
var type = action.type,
payload = action.payload,
meta = action.meta;
// Assign values for promise type suffixes
var _promiseTypeSuffixes = _slicedToArray(promiseTypeSuffixes, 3);
var _promiseTypeSuffixes = _slicedToArray(promiseTypeSuffixes, 3),
PENDING = _promiseTypeSuffixes[0],
FULFILLED = _promiseTypeSuffixes[1],
REJECTED = _promiseTypeSuffixes[2];
var PENDING = _promiseTypeSuffixes[0];
var FULFILLED = _promiseTypeSuffixes[1];
var REJECTED = _promiseTypeSuffixes[2];
/**

@@ -127,2 +126,3 @@ * @function getAction

var getAction = function getAction(newPayload, isRejected) {

@@ -133,3 +133,3 @@ return _extends({

payload: newPayload
}, !!meta ? { meta: meta } : {}, isRejected ? {
}, meta !== undefined ? { meta: meta } : {}, isRejected ? {
error: true

@@ -153,3 +153,3 @@ } : {});

promise = payload;
data = null;
data = undefined;
}

@@ -164,3 +164,3 @@

type: type + '_' + PENDING
}, !!data ? { payload: data } : {}, !!meta ? { meta: meta } : {}));
}, data !== undefined ? { payload: data } : {}, meta !== undefined ? { meta: meta } : {}));

@@ -191,3 +191,3 @@ /*

var handleFulfill = function handleFulfill() {
var value = arguments.length <= 0 || arguments[0] === undefined ? null : arguments[0];
var value = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : null;

@@ -245,3 +245,3 @@ var resolvedAction = getAction(value, false);

var _typeof = typeof Symbol === "function" && typeof Symbol.iterator === "symbol" ? function (obj) { return typeof obj; } : function (obj) { return obj && typeof Symbol === "function" && obj.constructor === Symbol ? "symbol" : typeof obj; };
var _typeof = typeof Symbol === "function" && typeof Symbol.iterator === "symbol" ? function (obj) { return typeof obj; } : function (obj) { return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; };

@@ -248,0 +248,0 @@ exports.default = isPromise;

@@ -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,c=r.meta,y=f(e,3),d=y[0],p=y[1],s=y[2],m=function(t,e){return i({type:n+"_"+(e?s:p)},null===t||"undefined"==typeof t?{}:{payload:t},c?{meta:c}:{},e?{error:!0}:{})},v=void 0,b=void 0;(0,l["default"])(r.payload)||"object"!==u(r.payload)?(v=a,b=null):(v=a.promise,b=a.data),t(i({type:n+"_"+d},b?{payload:b}:{},c?{meta:c}:{}));var h=function(t){var e=m(t,!0);throw o(e),t},x=function(){var t=arguments.length<=0||void 0===arguments[0]?null:arguments[0],e=m(t,!1);return o(e),{value:t,action:e}};return v.then(x,h)}}}}Object.defineProperty(e,"__esModule",{value:!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?"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(a){n=!0,u=a}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),c=["PENDING","FULFILLED","REJECTED"]},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?"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(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||y;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 h=function(t){var e=v(t,!0);throw o(e),t},x=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(x,h)}}}}Object.defineProperty(e,"__esModule",{value:!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=["PENDING","FULFILLED","REJECTED"]},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}])});
{
"name": "redux-promise-middleware",
"version": "4.1.0",
"version": "4.2.0",
"description": "Redux middleware for handling promises and optimistic updates",
"main": "dist/index.js",
"scripts": {
"start": "babel-node examples/server.js",
"prepublish": "npm run build",
"precommit": "echo 'Running pre-commit hooks...' && npm run test",
"prebuild": "npm run test",
"build": "npm run build-commonjs & npm run build-umd & npm run build-umd-min",
"build-commonjs": "`npm bin`/babel src -d dist",
"build-umd": "`npm bin`/webpack dist/ReduxPromiseMiddleware.js",
"build-umd-min": "NODE_ENV=production `npm bin`/webpack dist/ReduxPromiseMiddleware.min.js",
"pretest": "npm run lint",
"test": "make test_coverage",
"prelocal-test": "npm run lint",
"local-test": "make test",
"build": "npm run build:commonjs & npm run build:umd & npm run build:umd:min",
"build:commonjs": "`npm bin`/babel src -d dist",
"build:umd": "`npm bin`/webpack dist/ReduxPromiseMiddleware.js",
"build:umd:min": "NODE_ENV=production `npm bin`/webpack dist/ReduxPromiseMiddleware.min.js",
"prepublish": "npm test && npm run build",
"lint": "`npm bin`/eslint src/**/*.js examples/**/*.js test/**/*.js"
"test": "./bin/test.sh",
"lint": "`npm bin`/eslint src/**/*.js examples/**/*.js test/**/*.js",
"start": "babel-node examples/server.js"
},
"pre-commit": [
"precommit"
],
"repository": {

@@ -46,3 +49,3 @@ "type": "git",

"babel-core": "^6.7.2",
"babel-eslint": "^6.0.0",
"babel-eslint": "^7.1.1",
"babel-loader": "^6.2.4",

@@ -56,5 +59,7 @@ "babel-polyfill": "^6.7.4",

"coveralls": "^2.11.9",
"eslint": "^2.5.1",
"eslint-config-airbnb": "^6.2.0",
"eslint-plugin-react": "^4.2.3",
"eslint": "^3.10.2",
"eslint-config-airbnb": "^13.0.0",
"eslint-plugin-import": "^2.2.0",
"eslint-plugin-jsx-a11y": "^2.2.3",
"eslint-plugin-react": "^6.7.1",
"express-urlrewrite": "^1.2.0",

@@ -64,12 +69,13 @@ "faker": "^3.1.0",

"istanbul": "^1.0.0-alpha.2",
"json-server": "^0.8.9",
"json-server": "^0.9.1",
"lodash": "^4.6.1",
"mocha": "^2.3.3",
"mocha": "^3.1.2",
"mocha-lcov-reporter": "^1.2.0",
"react": "^0.14.7",
"react-dom": "^0.14.7",
"pre-commit": "^1.1.3",
"react": "^15.0.0",
"react-dom": "^15.0.0",
"react-redux": "^4.4.1",
"react-router": "^2.0.1",
"redux": "^3.0.4",
"redux-mock-store": "1.0.3",
"redux-mock-store": "1.2.1",
"redux-thunk": "^2.0.1",

@@ -76,0 +82,0 @@ "sinon": "^1.17.2",

# Redux Promise Middleware
[![npm version](https://img.shields.io/npm/v/redux-promise-middleware.svg?style=flat)](https://www.npmjs.com/package/redux-promise-middleware) [![Build Status](https://travis-ci.org/pburtchaell/redux-promise-middleware.svg?branch=master)](https://travis-ci.org/pburtchaell/redux-promise-middleware) [![Coverage Status](https://coveralls.io/repos/pburtchaell/redux-promise-middleware/badge.svg?branch=master&service=github)](https://coveralls.io/github/pburtchaell/redux-promise-middleware?branch=master) [![npm downloads](https://img.shields.io/npm/dm/redux-promise-middleware.svg?style=flat)](https://www.npmjs.com/package/redux-promise-middleware) [![Known Vulnerabilities](https://snyk.io/test/npm/redux-promise-middleware/badge.svg)](https://snyk.io/test/npm/redux-promise-middleware)
[![npm version](https://img.shields.io/npm/v/redux-promise-middleware.svg?style=flat)](https://www.npmjs.com/package/redux-promise-middleware) [![Build Status](https://travis-ci.org/pburtchaell/redux-promise-middleware.svg?branch=master)](https://travis-ci.org/pburtchaell/redux-promise-middleware) [![Coverage Status](https://coveralls.io/repos/pburtchaell/redux-promise-middleware/badge.svg?branch=master&service=github)](https://coveralls.io/github/pburtchaell/redux-promise-middleware?branch=master) [![npm downloads](https://img.shields.io/npm/dm/redux-promise-middleware.svg?style=flat)](https://www.npmjs.com/package/redux-promise-middleware)
Redux promise middleware enables robust handling of async code in [Redux](http://redux.js.org). The middleware enables optimistic updates and dispatches pending, fulfilled and rejected actions. It can be combined with [redux-thunk](https://github.com/gaearon/redux-thunk) to chain async actions.
Redux promise middleware enables robust handling of async code in [Redux](http://redux.js.org). The middleware enables optimistic updates and dispatches pending, fulfilled and rejected actions. It can be combined with [redux-thunk](https://github.com/gaearon/redux-thunk) to chain async actions. If you are curious to see how the middleware works, [browse the source code](https://sourcegraph.com/github.com/pburtchaell/redux-promise-middleware/-/blob/src/index.js) on Sourcegraph!

@@ -7,0 +7,0 @@ ## Docs and Help

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