UNPKG

redux-logic

Version:

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

36 lines (34 loc) 1.13 kB
import "core-js/modules/es.array.map.js"; import "core-js/modules/es.object.to-string.js"; import "core-js/modules/es.regexp.to-string.js"; import "core-js/modules/esnext.iterator.map.js"; export 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 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 export function wrapActionForIntercept(act) { /* istanbul ignore if */ if (!act) { return act; } return { __interceptAction: act }; } export function isInterceptAction(act) { // eslint-disable-next-line no-underscore-dangle return act && act.__interceptAction; } export function unwrapInterceptAction(act) { // eslint-disable-next-line no-underscore-dangle return act.__interceptAction; }