Created
September 12, 2018 18:55
-
-
Save gate5th/efdf0a490fca3adfce96479c69bcefe6 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
async function identifyAlbumsByArtistId(artistId, returnSimpleArray=true) { | |
//returns an array of albumIds that appear in the playlist, without duplicates | |
const arrayOfAlbumObjects = await spotifyApi.getArtistAlbums(artistId) | |
let albumIds = arrayOfAlbumObjects.items.map((albumObj) => { | |
if (returnSimpleArray) { | |
return albumObj.id | |
} else { | |
return ({albumId: albumObj.id, albumName: albumObj.name, albumUri: albumObj.uri}) | |
} | |
}) | |
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