Utility method to extend mickey model.
$ npm install --save mickey-model-extend
import modelExtend from 'mickey-model-extend';
const base = {
state: {
foo: null,
},
add: (state, payload) => state + payload,
};
const model = modelExtend(base, {
namespace: 'foo.bar',
state: {
bar: 1,
},
});
Behaviour:
model.namespace
will be overrided by latter modelmodel.createReducer
will be overrided by latter modelmodel.state
will be merged withObject.assign
model.state
will be overrided by latter model if it isn't an objectmodel[subscriptions|enhancers]
will be merged to a array- reducer functions will be merge with
Object.assign
Pull requests and stars are highly welcome.
For bugs and feature requests, please create an issue.