Skip to content

Commit

Permalink
Style: Improved code readability
Browse files Browse the repository at this point in the history
  • Loading branch information
fvdm committed Dec 16, 2023
1 parent 59a4708 commit e32718a
Showing 1 changed file with 7 additions and 2 deletions.
9 changes: 7 additions & 2 deletions searchitunes.js
Original file line number Diff line number Diff line change
Expand Up @@ -18,11 +18,14 @@ License: Unlicense (Public Domain, see UNLICENSE file)
*/

module.exports = async function SearchItunes ( {

timeout = 5000,
userAgent = 'searchitunes.js',
trackId,

} ) {
let first;

let params = arguments[0];
let url = 'https://itunes.apple.com/search';

Expand All @@ -43,7 +46,7 @@ module.exports = async function SearchItunes ( {
delete params.trackId;
}

// Search or lookup
// Lookup API
const idKeys = [
'amgAlbumId',
'amgArtistId',
Expand All @@ -60,7 +63,7 @@ module.exports = async function SearchItunes ( {
first = true;
}

// Process request
// Process
params = new URLSearchParams( params );
url += '?' + params.toString();

Expand All @@ -75,5 +78,7 @@ module.exports = async function SearchItunes ( {
return data.results[0];
}

// Search response
return data;

};

0 comments on commit e32718a

Please sign in to comment.