Skip to content

Instantly share code, notes, and snippets.

@cwharris
Created July 7, 2014 02:40
Show Gist options
  • Save cwharris/d7085d2a204f7a23bf4d to your computer and use it in GitHub Desktop.
Save cwharris/d7085d2a204f7a23bf4d to your computer and use it in GitHub Desktop.
movieFinder.find('Falcon')
.flatMap(function (movie) {
return geocoder
.geocode(movie.locations)
.take(1)
.pluck('geometry.location')
.map(function (location) {
return {
location: location,
movie: movie
};
});
})
.subscribe(log);
movieFinder.find('Falcon')
.flatMap(movieToResult)
.subscribe(log);
function movieToResult (movie) {
return geocoder
.geocode(movie.location)
.take(1)
.pluck('geometry.location')
.map(movieAndLocationToResult.bind(undefined, movie));
}
function movieAndLocationToResult (movie, location) {
return {
movie: movie,
location: location
};
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment