I have 2 objects, for example: 1st:
const langs = {
en: {
components: {
test: 'test'
},
},
de: {
components: {
test: 'test'
},
},
};
2nd:
const langs2 = {
en: {
app: {
test: 'test'
},
},
pl: {
app: {
test: 'test'
},
},
};
And now i need to merge these 2 object into one, it should looks like:
{
en: {
components: {
test: 'test'
},
app: {
test: 'test'
},
},
de: {
components: {
test: 'test'
},
},
pl: {
app: {
test: 'test'
},
},
};
There is any solution to do that? I tried Object.assign but when I have 2 same named properties it just override them. So, when I have same lang in 2 object it should extend it, when I have different lang it should just add that to object. I cant use jquery or other lib, so it must be pure js (es6 avaible)