Created
February 27, 2021 01:06
-
-
Save lvngd/ccb12bc49372b95c670774e3660a391f to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
function flattenData(data){ | |
let flatData = []; | |
data.forEach(band => { | |
band.bandAlbums.forEach(album => { | |
album.albumSongs.forEach(song =>{ | |
flatData.push({bandName: band.bandName, | |
bandUrl: band.bandUrl, | |
albumName: album.albumName, | |
albumType: album.albumType, | |
albumYear: album.albumYear, | |
songName: song.songName, | |
songUrl: song.songUrl | |
}); | |
}); | |
}); | |
}); | |
return flatData; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment