Skip to content

Instantly share code, notes, and snippets.

@mlevkovsky
Created July 20, 2019 21:34
Show Gist options
  • Save mlevkovsky/17a768152f2ca13962fab1c1a05a13b9 to your computer and use it in GitHub Desktop.
Save mlevkovsky/17a768152f2ca13962fab1c1a05a13b9 to your computer and use it in GitHub Desktop.
redundant variables
getBackgroundArt(track: Track): BackgroundImage {
switch(track.getGenre()) {
case "hiphop":
const hipHopImage: BackgroundImage = {dimension: 'small', 'url': 'https://unsplash.com/photos/Qcl98B8Bk3I'};
return hipHopImage;
case "jazz":
const jazzImage : BackgroundImage = {dimension: 'small', 'url': 'https://unsplash.com/photos/dBWvUqBoOU8'};
return jazzImage;
case "rap":
const rapImage : BackgroundImage = {dimension: 'small', 'url': 'https://unsplash.com/photos/auq_QbyIA34'};
return rapImage;
case "country":
const countryImage: BackgroundImage = {dimension: 'small', 'url': 'https://unsplash.com/photos/RnFgs90NEHY'};
return countryImage;
default:
const defaultImage: BackgroundImage = {dimension: 'small', 'url': 'https://unsplash.com/photos/PDX_a_82obo'};
return defaultImage;
}
}
getBackgroundArt(track: Track): BackgroundImage {
let backgroundImage: BackgroundImage;
switch(track.getGenre()) {
case "hiphop":
backgroundImage = {dimension: 'small', 'url': 'https://unsplash.com/photos/Qcl98B8Bk3I'};
break;
case "jazz":
backgroundImage = {dimension: 'small', 'url': 'https://unsplash.com/photos/dBWvUqBoOU8'};
break;
case "rap":
backgroundImage = {dimension: 'small', 'url': 'https://unsplash.com/photos/auq_QbyIA34'};
break;
case "country":
backgroundImage = {dimension: 'small', 'url': 'https://unsplash.com/photos/RnFgs90NEHY'};
break;
default:
backgroundImage = {dimension: 'small', url : 'https://unsplash.com/photos/PDX_a_82obo'};
}
return backgroundImage;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment