[Vuejs]-Lodash merge: only copy object properties if source value matches destination value

0๐Ÿ‘

โœ…

I was able to get every scenario working using the following customizer function along with mergeWith:

mergeWith({}, destination, source, customizer);

const customizer = (objValue, srcValue, key) => {
  if (key === "addresses") {
    let merged = merge(
      keyBy(objValue, "addressType"),
      keyBy(srcValue, "addressType")
    );
    let value = values(merged);
    return value;
  }
};

Leave a comment