I am working with an object that has a many-to-one mapping setup:
{
'a' : 'one',
'b' : 'two',
'c' : 'one',
'd' : 'two'
}
My goal is to transform this object into the following structure:
{
'one' : ['a' , 'c'],
'two' : ['b' , 'd']
}
What is the most efficient way to achieve this transformation in javascript? (We are open to using underscore libraries if it simplifies the process) Please note that the objects provided above are simplified examples of the actual data we are working with.