Go through an object to sum the number of children

I feel like this is an easy solve, but I’ve been stuck for a while, so thought I’d reach out for help.

I have an array of objects as per below.

songs = [
{ track_name: "name of track" , track_genres: ["chamber pop","indie pop"] },
{ track_name: "name of track 2" , track_genres: ["dutch r&b","indie soul", "indie pop"] },
{ track_name: "name of track 3" , track_genres: ["indie pop","chamber pop","indie soul"] }
]

I will then make a “mapping” object so each child gets a parent genre assigned to them. I shall be doing this manually (if you have ideas on doing it automatically through code, that’d be great too, but not the core issue for the question)

genres = [
{
name: "Pop",
children: [{name:"Chamber Pop"},{name:"Indie Pop"}]
},
{
name: "R&B",
children: [{name:"Dutch R&B"}]
},
{
name: "Soul",
children: [{name:"Indie Soul"}]
}
]

I now want to run through all tracks in “songs” and populate the size in the respective children of genres. Ideal Output should be:

genres = [
{
name: "Pop",
children: [{name:"Chamber Pop", size:2},{name:"Indie Pop", size:3}]
},
{
name: "R&B",
children: [{name:"Dutch R&B", size:1}]
},
{
name: "Soul",
children: [{name:"Indie Soul", size:2}]
}
]

Any help on this would be appreciated. I’ll be using javascript for this, happy to use lodash/underscore as well if it’s more efficient.

I know how to loop through tracks, but once I have a particular child genre, I’m not able to efficiently map it to the genres variable