Skip to content

Instantly share code, notes, and snippets.

@dbani-dev
Forked from bendc/merge.js
Created July 22, 2016 03:54
Show Gist options
  • Save dbani-dev/5fb2364cc45d5a320e07671fd46a6fe8 to your computer and use it in GitHub Desktop.
Save dbani-dev/5fb2364cc45d5a320e07671fd46a6fe8 to your computer and use it in GitHub Desktop.
Deep merge of JSON-like objects
const merge = (() => {
const duplicate = object => JSON.parse(JSON.stringify(object));
return (...objects) => Object.assign(...objects.map(duplicate));
})();
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment