redux-loop
Version:
Sequence your effects naturally and purely by returning them from your reducers.
30 lines (21 loc) • 1.01 kB
JavaScript
;
Object.defineProperty(exports, "__esModule", {
value: true
});
exports.isPromiseLike = exports.throwInvariant = exports.flatten = void 0;
function _typeof(obj) { "@babel/helpers - typeof"; if (typeof Symbol === "function" && typeof Symbol.iterator === "symbol") { _typeof = function _typeof(obj) { return typeof obj; }; } else { _typeof = function _typeof(obj) { return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }; } return _typeof(obj); }
var concat = Array.prototype.concat;
var flatten = function flatten(array) {
return concat.apply([], array);
};
exports.flatten = flatten;
var throwInvariant = function throwInvariant(condition, message) {
if (!condition) {
throw Error(message);
}
};
exports.throwInvariant = throwInvariant;
var isPromiseLike = function isPromiseLike(obj) {
return !!obj && _typeof(obj) === 'object' && typeof obj.then === 'function';
};
exports.isPromiseLike = isPromiseLike;