Permalink
Browse files

Better formatting for promise chain

  • Loading branch information...
1 parent f5135ac commit 9bd9af741934c5903d300c70e483d22f6de767cc @philnash committed Feb 9, 2017
Showing with 6 additions and 2 deletions.
  1. +6 −2 _posts/2017-02-09-toast-to-es2015-destructuring.md
@@ -37,8 +37,12 @@ Let's take a look at the code:
{% highlight javascript %}
const punkAPIUrl = "https://api.punkapi.com/v2/beers/106"
const deadPonyClubUrl = "https://api.punkapi.com/v2/beers/91"
- const piProm = fetch(punkAPIUrl).then(res => res.json()).then(data => Promise.resolve(data[0]));
- const dpcProm = fetch(deadPonyClubUrl).then(res => res.json()).then(data => Promise.resolve(data[0]));
+ const piProm = fetch(punkAPIUrl)
+ .then(res => res.json())
+ .then(data => Promise.resolve(data[0]));
+ const dpcProm = fetch(deadPonyClubUrl)
+ .then(res => res.json())
+ .then(data => Promise.resolve(data[0]));
Promise.all([piProm, dpcProm]).then(beers => {
const punkIPA = beers[0];

0 comments on commit 9bd9af7

Please sign in to comment.