I have been trying to combine objects with same value. The object that I have is like this:
{
'Mon': [{'apple': 'A', 'color': 'green'}, {'apple':'B', 'color':'yellow'}],
'Tue': [{'apple': 'A', 'color': 'green'}, {'apple':'B', 'color':'yellow'}],
'Wed': [],
'Thu': [],
'Fri': [{'banana': 'A', 'color': 'yellow'}],
'Sat': [{'banana': 'A', 'color': 'yellow'}],
'Sun': [{'banana': 'A', 'color': 'yellow'}]
}
I have been trying to find a way to combine these so that the result would be like this:
{
['Mon', 'Tue']: [{'apple': 'A', 'color': 'green'}, {'apple':'B','color':'yellow'}],
['Wed', 'Thu']: [],
['Fri','Sat','Sun']: [{'banana': 'A', 'color': 'yellow'}]
}
Is there some way to do this with lodash ? or pure js ?