Luigi Cavalieri - Coding, Sharing, Blogging

Blog / JavaScript

  1. A Custom Function to Deeply Merge Two Objects in ES6+

    A Custom Function to Deeply Merge Two Objects in ES6+

    While working on a recent JavaScript project, I found myself in need of merging together an object of default values, with a second object of custom values. The complication was that the two objects could contain other objects nested in, and that the operation could not limit itself to shallowly merge those child objects. After a little work, mergeObjectsDeep() was born to be shared.