updux/dist/buildUpreducer/index.js

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