Skip to content

Instantly share code, notes, and snippets.

@andrewho83
Created August 4, 2015 01:32
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save andrewho83/45ae6e858f11467a3813 to your computer and use it in GitHub Desktop.
Save andrewho83/45ae6e858f11467a3813 to your computer and use it in GitHub Desktop.
Bluebid Promises
var streamPromise = FeedManager.getLiveStreams(requestingUserId, options);
var videos = streamPromise.then(function(response) {
nextPage = response.nextPage;
return response.streams
}).map(function(stream) {
return DataConverter.getVideoFromStreamObject(stream);
}).map(function(video) {
return APIConverter.getExternalVideoObject(video);
}).then(function(videos) {
res.json({
videos: videos,
nextPage: nextPage
});
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment