data = {
const S = [];
yield S;
let pages = await fetchGithubResponse(`/repos/${repo}/stargazers`, {per_page: 100}, fetchOptions)
.then(d => [...d.headers].find(d => d[0] === "link")?.[1].split(/,/).pop().match(/&page=(\d+)/)?.[1] || 1);
let l = Math.min(maxPages, pages);
mutable pages_remaining = l;
for (const page of new Set([1, +pages].concat(d3.shuffle(d3.range(2, +pages))))) {
const s = await fetchGithub(`/repos/${repo}/stargazers`, {per_page: 100, page}, fetchOptions);
if (!s) return;
if (s.message) return mutable error_message = s.message;
s.forEach((u, i) => {
S.push({
login: u.user.login,
id: u.user.id,
date: new Date(u.starred_at),
count: 100 * (page - 1) + i + 1,
repo
});
});
S.sort((a, b) => a.count - b.count);
yield S;
mutable pages_remaining = --l;
if (l === 0) break;
await Promises.delay(150);
}
yield S;
}