I’m not sure why the first block of code in the article uses promises like the old callback hell, but here it is the proper way to write that first block of code:
.then( sortByToppings )
.then( checkDeliveryOptions )
.then( checkBirthdayGift )
.then( sendToCustomer );
And, in my opinion, it looks better then the alternatives offered by the article, not mentioning the testability of it.
Agree, I think promises are better that async/await when it comes to function composition.
That was a bad example, not to be used
We're a place where coders share, stay up-to-date and grow their careers.
We strive for transparency and don't collect excess data.