Skip to content

Instantly share code, notes, and snippets.

Created August 29, 2017 17:09
Show Gist options
  • Save anonymous/a7d1598388322bc6690c0b8380743b48 to your computer and use it in GitHub Desktop.
Save anonymous/a7d1598388322bc6690c0b8380743b48 to your computer and use it in GitHub Desktop.
exports.playlistExists = function( name, playlists ) {
// console.log( playlists );
return new Promise( (resolve, reject) => {
let index = playlists.findIndex( p => p.name.toLowerCase() === name.toLowerCase() );
resolve({ index });
});
}
exports.createPlaylist = function( name ) {
return exports.playlists()
.then( playlists => exports.playlistExists(name, playlists.items), function( err ) {
console.log('err', err );
})
.then( response => {
if( reponse.index <= -1 ) {
}
return response;
}, function( err ) {
console.log('err', err );
})
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment