This package extends the functionality given by Object.assign() to also include the values of nested objects.
npm install --save nested-object-assign
Works just like Object.Assign, add an empty object first (the object you want the other objects merged into), then as many objects as you wish afterwards, comma separated.
importnestedObjectAssignfrom'nested-object-assign';constdefaults={}functiontest(){letdata=nestedObjectAssign({},defaults,object1,object2,object3);}Tests were done for these node.js versions:
- 8
- 7
- 6