Created
June 7, 2017 08:58
-
-
Save keithwhor/d2e37f33234b99bac2901888f6db2aab to your computer and use it in GitHub Desktop.
StdLib Async Gist
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/** | |
* async / await supported natively! | |
* @param {array} ratings Our ratings out of five from top dentists | |
* @returns {object} | |
*/ | |
module.exports = async function (ratings = [5, 5, 3, 5]) { | |
let lastRating = await getDentistRatingWhoIsSlowToRespond(); | |
ratings.push(lastRating); | |
return { | |
dentists_we_dislike: ratings | |
.map((v, i) => {index: i, rating: v}) | |
.filter(dentist => dentist.rating < 5) | |
}; | |
}; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment