Skip to content

Instantly share code, notes, and snippets.

@keithwhor
Created June 7, 2017 08:58
Show Gist options
  • Save keithwhor/d2e37f33234b99bac2901888f6db2aab to your computer and use it in GitHub Desktop.
Save keithwhor/d2e37f33234b99bac2901888f6db2aab to your computer and use it in GitHub Desktop.
StdLib Async Gist
/**
* 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