Last active
September 23, 2016 00:39
-
-
Save KoryNunn/d24a3469c3b16950307579f52ea44813 to your computer and use it in GitHub Desktop.
This file contains hidden or 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
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