fixed update.assign for deep object merges#3
fixed update.assign for deep object merges#3AleksandrZhukov wants to merge 1 commit intoakuzko:masterfrom
Conversation
- common js `Object.assign` doesn't have ability to merge objects deeply so added `mergeDeep` for these needs - note: arrays will be replaced with new one
|
@AleksandrZhukov sorry for long reply. Initially project was built in pure ES5 with no traspiling, so the code at the moment you opened this PR had to be ES5-compatible. transpiling was added in It is intended for const initialTodos = {
settings: {
can: {}
},
items: []
};
// at some point of time we have something like
data = {
todos: {
settings: {
can: {edit: true}
},
items: [todo1],
valueWeWantToKeep: true
}
}
// then later on we want to drop portion of `todos` data with
const nextData = update.assign(data, 'todos', initialTodos);with deep-assign behavior, this code won't drop what I would actually suggest is to add |
Object.assigndoesn't have ability to merge objects deeply so addedmergeDeepfor these needs