UNPKG

higher-order-reducers

Version:

A library of simple everyday reducer utility functions

22 lines (19 loc) 590 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 always = function always(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 = always;