Created
July 18, 2024 16:58
-
-
Save dinocarl/772a6b73e0ce88335eaa900d7e7977df to your computer and use it in GitHub Desktop.
Simplistic recursive merge fn for JS
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
const recMerge = (objA, objB) => Object.entries(objB).reduce( | |
(acc, [key, val]) => Object.assign( | |
{}, | |
objA, | |
{ [key]: is(Object, val) ? recMerge(objA[key], val) : val } | |
), | |
{} | |
); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment