updux/dist/buildUpreducer/index.js
2019-10-29 11:40:13 -04:00

15 lines
460 B
JavaScript

"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
function buildUpreducer(initial, mutations) {
return (action) => (state) => {
if (state === undefined)
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