Skip to content

Instantly share code, notes, and snippets.

What would you like to do?
const combine = (...args) =>
[], value) => {
// Create an object with duplicates combined
const duplicates = Object.keys(value)
.filter(key => next.hasOwnProperty(key))
.map(key => {
return {
[key]: Object.assign(value[key], next[key])
(accumulator, current) => Object.assign(accumulator, current),
// Create a new object with everything combined together
return Object.assign(next, value, duplicates);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.