lorenwest/node-config — pull request #175 by markstos (2014-11-19 18:23:17+00:00)
Title: BugFix: deferred values should be treated like atomic values, not objects.

There was an edge case when a deferred function returned an object.

When extendDeep does its recursion and ran into a deferred value, it would
continue to recurse into it, potentially doing a deep merge with a child
config file.

Because the deferred value did not get /replaced/ by the child object as
intended, it continued to be an 'instanceof' the DeferredConfig prototype.

So as a final step, the deferred function was executed to compute a final
value when it should not have been.

The result was this the child fails to properly override the deferred
function with a static value, because deferred function was getting run
anyway.

The included test coverage illustrates such a case.

This fix does not the affect the general utility of extendDeep, as only
objects that are 'instanceof' the newly-introduced DeferredConfig object
are effected.