function fetchPagedContributors()

in scripts/contributor.js [68:96]


function fetchPagedContributors(url, index, page, currentResults) {
  return fetch(url.replace('%d', page))
    .then(function(res) {
      return res.json();
    })
    .then(function(data) {
      // Add the newly fetched data to currentResults
      var newResults = currentResults.concat(
        data.map(function(contributor) {
          return {
            name: contributor.login,
            github: contributor.html_url,
            avatar: contributor.avatar_url,
          };
        }).filter(function(contributor) {
          return !ignoreList.includes(contributor.name);
        })
      );

      // If the returned data length is equal to 100, continue to request the next page
      if (data.length === 100) {
        return fetchPagedContributors(url, index, page + 1, newResults);
      } else {
        // Add the final newResults to the allContributors array.
        allContributors = allContributors.concat(newResults);
        return newResults;
      }
    });
}