add node modules
This commit is contained in:
34
node_modules/@octokit/plugin-paginate-rest/dist-src/paginate.js
generated
vendored
Normal file
34
node_modules/@octokit/plugin-paginate-rest/dist-src/paginate.js
generated
vendored
Normal file
@@ -0,0 +1,34 @@
|
||||
import { iterator } from "./iterator.js";
|
||||
function paginate(octokit, route, parameters, mapFn) {
|
||||
if (typeof parameters === "function") {
|
||||
mapFn = parameters;
|
||||
parameters = void 0;
|
||||
}
|
||||
return gather(
|
||||
octokit,
|
||||
[],
|
||||
iterator(octokit, route, parameters)[Symbol.asyncIterator](),
|
||||
mapFn
|
||||
);
|
||||
}
|
||||
function gather(octokit, results, iterator2, mapFn) {
|
||||
return iterator2.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, iterator2, mapFn);
|
||||
});
|
||||
}
|
||||
export {
|
||||
paginate
|
||||
};
|
||||
Reference in New Issue
Block a user