I wrote a merge function for a sort of deep copy, but more like a nested copy. Full deep copy gets complex quickly as questions come up about arrays. Do you replace, interlace, sort and/or append?
Here’s a merge and an unmerge (e.g. subtract) for simple nested javascript objects: