Here is an example of an array of objects:
[
{
item: "123",
categories: [A,B,C]
},
{
item: "456",
categories: [B,C]
},
{
item: "789",
categories: [C,D,E]
}
]
I'm exploring using Lodash in typescript to group this data by category and generate the following output:
[
{
category: A,
Items: ["123"]
},
{
category: B,
Items: ["123","456"]
},
{
category: C,
Items: ["123","456","789"]
},
{
category: D,
Items: ["789"]
},
{
category: E,
Items: ["789"]
}
]