// A strict deep-merging implementation that *only* merges regular objects, and prevents prototype pollution
// A strict deep-merging implementation that *only* merges regular objects, and prevents prototype pollution, and also optionally allows specifying a value mapper (to avoid the need for a second traversal)
// FIXME: Publish this as a stand-alone package?
functionisObject(value){
// TODO: Disallow special object types, for statically defined values (or just disallow specifying static values in the root schema in dlayer?)
// FIXME: The __moduleID is a hack to prevent it from recognizing a module-association wrapper as a schema object; should find a better way to do this, that generalizes to a stand-alone package
@ -23,11 +25,14 @@ module.exports = function deepMerge(a, b) {
if(isObject(valueA)&&valueB===undefined){
merged[key]=valueA;
}elseif(isObject(valueB)&&valueA===undefined){
merged[key]=valueB;
// This looks hacky, but it ensures that the behaviour (eg. value mapping) is consistent between initially-created subtrees and those that are merged in later