I have the following object structure:
[{
directory: 'dir1',
fileName: 'file1.png'
},
{
directory: 'dir2',
fileName: 'file2.png'
},
{
directory: 'dir1',
fileName: 'file2.png'
},
{
directory: 'dir1',
fileName: 'file3.png'
},
{
directory: 'dir2',
fileName: 'test.png'
}
}]
I want to postprocess this information to yield the following grouping:
{
"dir1": ["file1.png", "file2.png"],
"dir2": ["file1.png", "file2.png"],
}
I'm using just plain old vanilla JS. What is the best way to accomplish something like this?