For a merge recursive method in JavaScript, it seems good to use lodash.merge.
・_.merge - Lo-Dash documentation
I won’t write explanations here, so it’s good to read the reference information.
・underscore.jsだと再帰的にマージできないのでlodashを使う - Labo Memo
That’s all from the Gemba.