Skip to content

Commit

Permalink
fixes galore ⭐
Browse files Browse the repository at this point in the history
  • Loading branch information
lacymorrow committed Feb 27, 2018
1 parent 061e9bd commit 5480619
Showing 1 changed file with 7 additions and 8 deletions.
15 changes: 7 additions & 8 deletions index.js
Original file line number Diff line number Diff line change
Expand Up @@ -23,8 +23,9 @@

function movieInfo ( movie, year, cb ) {

// search parameters
// Search parameters
var search = {
// TMDB key (public on purpose)
key: '9d2bff12ed955c7f1f74b83187f188ae',
base: 'https://api.themoviedb.org',
imageBase: 'http://image.tmdb.org/t/p/original',
Expand All @@ -45,6 +46,7 @@
search.year = year

}
if ( typeof cb !== 'function' ) cb = null

var url =
search.base +
Expand Down Expand Up @@ -85,7 +87,7 @@
if ( search.year !== null ) {

search.year = null
return movieInfo( search.movie, null )
return movieInfo( search.movie, null, cb )

} else {

Expand All @@ -103,19 +105,16 @@
}

} )
.catch( function ( error ) {
.catch( error => error )

return error

} )

// Callback and return Promise
// Callback
if ( cb ) {

return response.then( res => cb( null, res ), err => cb( err, null ) )

}

// Promise
return response

}
Expand Down

0 comments on commit 5480619

Please sign in to comment.