Skip to content

Instantly share code, notes, and snippets.

@KoryNunn
Last active September 23, 2016 00:39
Show Gist options
  • Save KoryNunn/d24a3469c3b16950307579f52ea44813 to your computer and use it in GitHub Desktop.
Save KoryNunn/d24a3469c3b16950307579f52ea44813 to your computer and use it in GitHub Desktop.
var matches = righto(getSoccerMatches); // <- Ye Olde error-back
var results = righto(getSoccerResults); // <- Ye Olde error-back
var detailedMatches = righto.sync(function(matches, results){
return matches.map(function( match ) {
return {
name: match.name,
score: findScoreForMatch(match, results)
};
});
}, matches, results);
detailedMatches(function(error, result){ // <- Exposes a Ye Olde error-back consuming function
if(error){
return console.error( 'Failed to print the score', error );
}
details.forEach(function( detailedMatch ) {
const name = detailedMatch.name;
const score = detailedMatch.score;
console.log( `${name} with the score ${score}` );
});
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment