higher-order-reducers
Version:
A library of simple everyday reducer utility functions
15 lines (13 loc) • 375 B
JavaScript
;
Object.defineProperty(exports, "__esModule", {
value: true
});
var linkIf = function linkIf(predicate) {
if (typeof predicate !== 'function') {
throw new Error('Supplied predicate to "linkIf" is not a function');
}
return function (state, action, next) {
return predicate(state, action) ? next(state) : state;
};
};
exports.default = linkIf;