mirror of
https://code.forgejo.org/actions/setup-node.git
synced 2025-06-09 13:41:11 +00:00
.
This commit is contained in:
parent
beb1329f9f
commit
2b95e76931
7736 changed files with 1874747 additions and 51184 deletions
node_modules/@octokit/rest/plugins/pagination
54
node_modules/@octokit/rest/plugins/pagination/paginate.js
generated
vendored
54
node_modules/@octokit/rest/plugins/pagination/paginate.js
generated
vendored
|
@ -1,34 +1,40 @@
|
|||
module.exports = paginate
|
||||
module.exports = paginate;
|
||||
|
||||
const iterator = require('./iterator')
|
||||
const iterator = require("./iterator");
|
||||
|
||||
function paginate (octokit, route, options, mapFn) {
|
||||
if (typeof options === 'function') {
|
||||
mapFn = options
|
||||
options = undefined
|
||||
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)
|
||||
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
|
||||
}
|
||||
function gather(octokit, results, iterator, mapFn) {
|
||||
return iterator.next().then(result => {
|
||||
if (result.done) {
|
||||
return results;
|
||||
}
|
||||
|
||||
let earlyExit = false
|
||||
function done () {
|
||||
earlyExit = true
|
||||
}
|
||||
let earlyExit = false;
|
||||
function done() {
|
||||
earlyExit = true;
|
||||
}
|
||||
|
||||
results = results.concat(mapFn ? mapFn(result.value, done) : result.value.data)
|
||||
results = results.concat(
|
||||
mapFn ? mapFn(result.value, done) : result.value.data
|
||||
);
|
||||
|
||||
if (earlyExit) {
|
||||
return results
|
||||
}
|
||||
if (earlyExit) {
|
||||
return results;
|
||||
}
|
||||
|
||||
return gather(octokit, results, iterator, mapFn)
|
||||
})
|
||||
return gather(octokit, results, iterator, mapFn);
|
||||
});
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue