I've looked at a bunch of posts about this but none seem to do what I'm trying to do or at least none that I found durning my search.
I have two objects and I need to combine them both without overriding any properties. If two keys are the same then I need to concat their values. Example:
const base = {
icon: "icon--value1"
item: "item--value"
}
const extend = {
icon: "icon--value2"
item: "item--value"
list: "list--value"
}
Combined Objects
const combined = {
icon: "icon--value1 icon--value2"
item: "item--value"
list: "list--value"
}
I tried using es6 assign and es6 destructuring but they just override the values.
combined = {...base, ... extend}
Was not the result I was after. Anyone know how I could achieve the above ? Thanks in advance for any help.