Skip to content

Instantly share code, notes, and snippets.

@charmander
Forked from anonymous/javascript
Last active August 29, 2017 17:16
Show Gist options
  • Save charmander/fe39887b56fd16cff19ef88e6211d100 to your computer and use it in GitHub Desktop.
Save charmander/fe39887b56fd16cff19ef88e6211d100 to your computer and use it in GitHub Desktop.
exports.playlistExists = (name, playlists) => ({
index: playlists.findIndex(p => p.name.toLowerCase() === name.toLowerCase()),
});
exports.createPlaylist = name =>
exports.playlists()
.then(playlists => exports.playlistExists(name, playlists.items))
.then(response => {
if (response.index === -1) {
}
return response;
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment