Skip to content

Instantly share code, notes, and snippets.

@gate5th
Created September 12, 2018 18:52
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
Star You must be signed in to star a gist
Embed
What would you like to do?
oldschoolshuffle
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