updux/dist/buildUpreducer/index.js

15 lines
460 B
JavaScript
Raw Normal View History

2019-10-22 22:15:08 +00:00
"use strict";
2019-10-24 15:52:36 +00:00
Object.defineProperty(exports, "__esModule", { value: true });
2019-10-22 22:15:08 +00:00
function buildUpreducer(initial, mutations) {
2019-10-24 15:52:36 +00:00
return (action) => (state) => {
2019-10-29 15:35:13 +00:00
if (state === undefined)
2019-10-24 15:52:36 +00:00
state = initial;
const a = mutations[action.type] ||
mutations['*'];
if (!a)
return state;
return a(action.payload, action)(state);
};
}
exports.default = buildUpreducer;
//# sourceMappingURL=index.js.map