How would you write a JavaScript function which:
Takes in a list of objects to be (deeply) merged and outputs a “composite object” whose key/values are the result of deeply merging these objects.
Constructs this “composite object” such that: if the key/values of the original objects are changed after the composite object is created, and the composite object is queried for a key/value which depends on one of the changed values, the composite object will return a result which reflects that change (ie. the value is dynamically generated based on the current states of the original objects, and possibly memoized too)
There are a few libraries such as Lodash, deepmerge, object-accumulator, lazy-recursive-merge, Lazy.js which will do #1 above, but I know of nothing which can do #2.
How do you write a function that does both #1 and #2? Can one of the above libraries be used as a starting point for this?