I have an array:
[
{
theme: "low battery",
Number: "S-10",
components: [ "hardware", "battery" ]
},
{
theme: "bad sync",
Number: "S-11",
components: [ "software" ]
},
{
theme: "misc troubles",
Number: "S-12",
components: [ "hardware", "software" ]
}
]
So i want to group this array by "components" values. In other words, i want to know, how many times does component occures in array. For example:
[
{
component: "hardware",
amount: 2
},
{
component: "software",
amount: 2
},
{
component: "battery",
amount: 1
}
]