UNPKG

redux-logic

Version:

Redux middleware for organizing all your business logic. Intercept actions and perform async processing.

46 lines (43 loc) 1.41 kB
"use strict"; Object.defineProperty(exports, "__esModule", { value: true }); exports.identityFn = identityFn; exports.isInterceptAction = isInterceptAction; exports.stringifyType = stringifyType; exports.unwrapInterceptAction = unwrapInterceptAction; exports.wrapActionForIntercept = wrapActionForIntercept; require("core-js/modules/es.array.map.js"); require("core-js/modules/es.object.to-string.js"); require("core-js/modules/es.regexp.to-string.js"); require("core-js/modules/esnext.iterator.map.js"); function identityFn(x) { return x; } // Symbols and Arrays containing Symbols cannot be interpolated in template strings, // they must be explicitly converted with toString() // eslint-disable-next-line import/prefer-default-export function stringifyType(type) { return Array.isArray(type) ? type.map(function (type) { return type.toString(); }) : type.toString(); } // we want to know that this was from intercept (validate/transform) // so that we don't apply any processOptions wrapping to it function wrapActionForIntercept(act) { /* istanbul ignore if */ if (!act) { return act; } return { __interceptAction: act }; } function isInterceptAction(act) { // eslint-disable-next-line no-underscore-dangle return act && act.__interceptAction; } function unwrapInterceptAction(act) { // eslint-disable-next-line no-underscore-dangle return act.__interceptAction; }