I want to use native Object functions such as Object.assign() or similar instead of lodash's _.merge(). How can I do this if merge's object merging conditions are different from Object.assign()'s? If not possible with Object.assign(), how can I mimic _.merge in a created function?
Asked
Active
Viewed 932 times
1
-
2Lodash's `_.merge` is recursive, while `Object.assign` is not. If you have multi-level structures, there is no native way to clone them effectively, you'll have to write your own. ...Or use a library like Lodash. – VLAZ Oct 20 '20 at 06:13
-
1You know Lodash is written in JavaScript, right? Under the hood it's only using native functions. Have a look at the [source code](https://github.com/lodash/lodash/blob/4.17.15/lodash.js#L13437) – Phil Oct 20 '20 at 06:20
-
Does this answer your question? [What is the most efficient way to deep clone an object in JavaScript?](https://stackoverflow.com/questions/122102/what-is-the-most-efficient-way-to-deep-clone-an-object-in-javascript) – VLAZ Oct 20 '20 at 06:22