UNPKG

higher-order-reducers

Version:

A library of simple everyday reducer utility functions

22 lines (19 loc) 584 B
'use strict'; Object.defineProperty(exports, "__esModule", { value: true }); /** Higher-order reducer meant to be used with with the `chain` reducer. Will always call the next reducer with the result of `innerReducer` @param {function} innerReducer - The reducer to wrap @returns An updated state */ var link = function link(innerReducer) { if (typeof innerReducer !== 'function') { throw new Error('Supplied argument to "always" is not a reducer'); } return function (state, action, next) { return next(innerReducer(state, action)); }; }; exports.default = link;