How can I use lodash _.merge(obj, source)
without obj
being modified? I just want a return of the value that merge computes,but I want to keep my original object intact.
I assume this question applies to most lodash functions, but I haven't found a solution so far.
Simply provide an empty object as the target (merge
supports more than one source
value):
var result = _.merge({}, obj, source);
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With