I've been struggling to find a clean solution for merging two objects like the example below:
obj1 = {
key1: "ABC",
key2: "123",
key3: "UNIQUE1"
}
obj2 = {
key1: "ABC",
key2: "123",
key3: "UNIQUE2"
}
//I want to merge them to achieve the following output
obj3 = {
key1: "ABC",
key2: "123",
key3: ["UNIQUE1", "UNIQUE2"]
}
I am looking for a way to keep unique values per key in an array. I have explored options like lodash but haven't found a suitable solution yet. Any guidance would be greatly appreciated!