mirror of
https://github.com/softprops/action-gh-release.git
synced 2025-06-29 14:46:03 +00:00
node_modules
This commit is contained in:
parent
5e3f23f92c
commit
806116bda4
734 changed files with 224451 additions and 0 deletions
40
node_modules/@octokit/rest/plugins/pagination/paginate.js
generated
vendored
Normal file
40
node_modules/@octokit/rest/plugins/pagination/paginate.js
generated
vendored
Normal file
|
@ -0,0 +1,40 @@
|
|||
module.exports = paginate;
|
||||
|
||||
const iterator = require("./iterator");
|
||||
|
||||
function paginate(octokit, route, options, mapFn) {
|
||||
if (typeof options === "function") {
|
||||
mapFn = options;
|
||||
options = undefined;
|
||||
}
|
||||
options = octokit.request.endpoint.merge(route, options);
|
||||
return gather(
|
||||
octokit,
|
||||
[],
|
||||
iterator(octokit, options)[Symbol.asyncIterator](),
|
||||
mapFn
|
||||
);
|
||||
}
|
||||
|
||||
function gather(octokit, results, iterator, mapFn) {
|
||||
return iterator.next().then(result => {
|
||||
if (result.done) {
|
||||
return results;
|
||||
}
|
||||
|
||||
let earlyExit = false;
|
||||
function done() {
|
||||
earlyExit = true;
|
||||
}
|
||||
|
||||
results = results.concat(
|
||||
mapFn ? mapFn(result.value, done) : result.value.data
|
||||
);
|
||||
|
||||
if (earlyExit) {
|
||||
return results;
|
||||
}
|
||||
|
||||
return gather(octokit, results, iterator, mapFn);
|
||||
});
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue