-1

if I have two objects:

{a: 1, b: {c: 1}}

and

{d: 1, b: {e: 2}}

Is there an easy way to merge the two nondestructively to create the following object?

{a: 1, d: 1, b: {c: 1, e: 2}}
fox
  • 15,428
  • 20
  • 55
  • 85

1 Answers1

1

Yes, you can use Lodash. Here's the link to the method you need: https://lodash.com/docs/4.17.10#merge

Dani
  • 116
  • 1
  • 2
  • 8