"use strict"; ; exports.__esModule = true; exports["default"] = function (handlers, initialState) { return function (state, action) { if (state === void 0) { state = initialState; } return handlers .map(function (_a) { var unwrapper = _a.unwrapper, handler = _a.handler; return ({ unwrappedAction: unwrapper(action), handler: handler }); }) .reduce(function (currentState, _a) { var unwrappedAction = _a.unwrappedAction, handler = _a.handler; if (unwrappedAction) { return handler(currentState, unwrappedAction); } else { return currentState; } }, state); }; };