Combine all properties sharing the same key into a single object
npm i combine-same-keys
import combineSameKeys from 'combine-same-keys'
combineSameKeys(
{
foo: { color: 'red' },
bar: { fontSize: 16 }
},
{
foo: {
backgroundColor: 'gold',
lineHeight: 0
}
},
{ baz: { opacity: 1 } }
)
/*
{ foo: { color: 'red', backgroundColor: 'gold', lineHeight: 0 },
bar: { fontSize: 16 },
baz: { opacity: 1 } }
*/
Type: rest parameter with Object
entries
MIT © Rafael Rinaldi