I am looking for a way to merge many objects with the same key to a one big object. The number of objects can be more that 2.
For example I have this code:
const a = {
en: {
hello: 'Hello'
},
fr: {
hello: 'Bonjour'
}
}
const b = {
en: {
goodbye: 'Goodbye'
},
fr: {
goodbye: 'Au revoir'
}
}
How to merge that into this:
{
locale: 'en',
messages: {
en: {
hello: 'Hello',
goodbye: 'Goodbye'
},
fr: {
hello: 'Bonjour',
goodbye: 'Au revoir'
}
}
}
locale: 'en'?