Skip to content

Instantly share code, notes, and snippets.

@nallenanderson
Last active July 21, 2016 21:01
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save nallenanderson/eaada8c1c6f462abd0e92ea0c63053d5 to your computer and use it in GitHub Desktop.
Save nallenanderson/eaada8c1c6f462abd0e92ea0c63053d5 to your computer and use it in GitHub Desktop.
// After the first JSON is returned, we are going to convert the URL string by mapping over the array of objects and replacing the default cover image size.
.then( data => {
data.media.map( media => {
if(media.covers[0]){
// Replace the cover image size with "original" image size.
media.covers[0] = media.covers[0].replace('R320x240', 'original');
// Add the item to the jsonPost array.
jsonData = [...jsonData, media];
} else {
// Add the item to the jsonPost array.
jsonData = [...jsonData, media];
}
});
})
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment