@aszu/lazy-network
Advanced tools
Comparing version 0.4.2-5 to 0.4.2-6
@@ -37,2 +37,3 @@ "use strict"; | ||
var FUNCTIONAL_KEY = Symbol('FUNCTIONAL'); | ||
var EMPTY = []; | ||
@@ -84,6 +85,6 @@ var StatusResponseInterceptor = /*#__PURE__*/function (_ResponseListener) { | ||
var status = error.response.status; | ||
var functionalHandlersToExecute = this.handlers[FUNCTIONAL_KEY].filter(function (handler) { | ||
var functionalHandlersToExecute = (this.handlers[FUNCTIONAL_KEY] || EMPTY).filter(function (handler) { | ||
return handler.check(status); | ||
}); | ||
var handlersToBeExecuted = [].concat((0, _toConsumableArray2["default"])(this.handlers[status]), (0, _toConsumableArray2["default"])(functionalHandlersToExecute)); | ||
var handlersToBeExecuted = [].concat((0, _toConsumableArray2["default"])(this.handlers[status] || EMPTY), (0, _toConsumableArray2["default"])(functionalHandlersToExecute)); | ||
@@ -90,0 +91,0 @@ if (handlersToBeExecuted) { |
{ | ||
"name": "@aszu/lazy-network", | ||
"version": "0.4.2-5", | ||
"version": "0.4.2-6", | ||
"description": "The network layer wrapper, by lazy people for lazy people.", | ||
@@ -5,0 +5,0 @@ "main": "index.js", |
import ResponseListener from './ResponseListener' | ||
const FUNCTIONAL_KEY = Symbol('FUNCTIONAL') | ||
const EMPTY = [] | ||
@@ -29,7 +30,7 @@ class StatusResponseInterceptor extends ResponseListener { | ||
const functionalHandlersToExecute = this.handlers[FUNCTIONAL_KEY].filter( | ||
const functionalHandlersToExecute = (this.handlers[FUNCTIONAL_KEY] || EMPTY).filter( | ||
handler => handler.check(status) | ||
) | ||
const handlersToBeExecuted = [...this.handlers[status], ...functionalHandlersToExecute] | ||
const handlersToBeExecuted = [...(this.handlers[status] || EMPTY), ...functionalHandlersToExecute] | ||
@@ -36,0 +37,0 @@ if (handlersToBeExecuted) { |
50145
1132