Last active
August 29, 2015 14:12
-
-
Save SohumB/09c4a31ceed10f1bf55d to your computer and use it in GitHub Desktop.
This file contains 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
pageRecurse(fn, opts, page) { | |
var withPage = _.clone(opts); | |
withPage.page = page; | |
return fn(withPage).then(results => { | |
return _.isEmpty(results) | |
? results | |
: this.pageRecurse(fn, opts, page + 1).then(following => results.concat(following)); | |
}); | |
} | |
getReleasesFromPage(...args) { | |
return this.pageRecurse(opts => this.github.releases.listReleasesAsync(opts), ...args); | |
} | |
getPullRequestsFromPage(...args) { | |
return this.pageRecurse(opts => this.github.pullRequests.getAllAsync(opts), ...args); | |
} | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment