json-override.js
function overwriteKeys(baseObject, overrideObject, createNew) {
  if (!baseObject) {
    baseObject = {};
  }
  if (createNew) {
    baseObject = JSON.parse(JSON.stringify(baseObject));
  }
  Object.keys(overrideObject).forEach(function(key) {
    if (isObjectAndNotArray(baseObject[key]) && isObjectAndNotArray(overrideObject[key])) {
      overwriteKeys(baseObject[key], overrideObject[key]);
    }
    else {
      baseObject[key] = overrideObject[key];
    }
  });
  return baseObject;
}
function overwriteKeys(baseObject, overrideObject, createNew) {
  if (!baseObject) {
    baseObject = {};
  }
  if (createNew) {
    baseObject = JSON.parse(JSON.stringify(baseObject));
  }
  Object.keys(overrideObject).forEach(function(key) {
    if (isObjectAndNotArray(baseObject[key]) && isObjectAndNotArray(overrideObject[key])) {
      overwriteKeys(baseObject[key], overrideObject[key]);
    }
    else {
      baseObject[key] = overrideObject[key];
    }
  });
  return baseObject;
}
function overwriteKeys ( baseObject , overrideObject , createNew ) { if ( ! baseObject ) { baseObject = { } ; } if ( createNew ) { baseObject = JSON . parse ( JSON . stringify ( baseObject ) ) ; } Object . keys ( overrideObject ) . forEach ( function ( key ) { if ( isObjectAndNotArray ( baseObject [ key ] ) && isObjectAndNotArray ( overrideObject [ key ] ) ) { overwriteKeys ( baseObject [ key ] , overrideObject [ key ] ) ; } else { baseObject [ key ] = overrideObject [ key ] ; } } ) ; return baseObject ; }
'createNew' defaults to false
createNew defaults to false