Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Save reganstarr/99b6b0c00e2ac6868ddddd94d8400db8 to your computer and use it in GitHub Desktop.
Save reganstarr/99b6b0c00e2ac6868ddddd94d8400db8 to your computer and use it in GitHub Desktop.
var twitterHandle = "";
var bestAvailableImage = "";
if(input.user_twitter_link){
var indexOfLastSlash = input.user_twitter_link.lastIndexOf('/');
twitterHandle = input.user_twitter_link.substring(indexOfLastSlash + 1);
twitterHandle = '(@' + twitterHandle + ')';
}
if(input.hidpi_image){
bestAvailableImage = input.hidpi_image;
}
else{
bestAvailableImage = input.normal_image;
}
var output = {twitter_handle: twitterHandle, best_available_image: bestAvailableImage};
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment