Would you like to clone this notebook?

When you clone a notebook you are able to make changes without affecting the original notebook.

Cancel

getAllCommits

node v8.17.0
version: master
endpointsharetweet
const GitHubApi = require("github"); const Rx = require("rx"); const github = new GitHubApi(); const getCommitsAsync = (param) => github.repos.getCommits({ owner: 'amowu', repo: 'test-semantic-release', ...param }); const checkNextPage = (response) => github.hasNextPage(response) ? Rx.Observable.fromPromise(github.getNextPage(response)) : Rx.Observable.empty(); const concatAllCommits = (acc, curr) => acc.concat(curr.data); const getAllCommits$ = Rx.Observable .fromPromise(getCommitsAsync({ per_page: 100 })) .expand(checkNextPage) .reduce(concatAllCommits, []); // getAllCommits$.subscribe( // (commits) => console.log(commits) // ); const commits = await getAllCommits$.toPromise();
Loading…

no comments

    sign in to comment