I want if the hash to be the same then all objects key attribute 'values' got merged. and I don't want to use the spread operator in my code. Here is my input:
[
{
"hash": "12345",
"values": [1,2,3]
},
{
"hash": "12345",
"values": []
},
{
"hash": "12345",
"values": [4]
},
{
"hash": "6789",
"values": [9]
},
{
"hash": "6789",
"values": [1]
}
]
Here is the output I want
[
{
"hash": "12345",
"values": [1,2,3,4]
},
{
"hash": "12345",
"values": [1,2,3,4]
},
{
"hash": "12345",
"values": [1,2,3,4]
},
{
"hash": "6789",
"values": [1,9]
},
{
"hash": "6789",
"values": [1,9]
}
]