Created
September 12, 2018 18:52
-
-
Save gate5th/01f40541503000d525a537a0ead11b2c to your computer and use it in GitHub Desktop.
oldschoolshuffle
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 identifyAlbumsInPlaylist(simplifiedPlaylist, returnSimpleArray=true) { | |
//returns an array of albumIds that appear in the playlist, without duplicates | |
let albumIds = simplifiedPlaylist.map((track) => { | |
if (returnSimpleArray) { | |
return track.albumId | |
} else { | |
return ({albumId: track.albumId, albumName: track.albumName, albumUri: track.albumUri}) | |
} | |
}) | |
albumIds = uniq(albumIds); | |
albumIds = shuffleArray(albumIds); | |
return albumIds; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment