<commit_before>module.exports = githubClient;
var githubRequest = require('./githubRequest.js');

function githubClient(token) {
  var tokenPart = '';
  if (token) tokenPart = 'access_token=' + token + '&';
  var USERS = 'https://api.github.com/users?' + tokenPart + 'since=';
  var USER_DETAILS = 'https://api.github.com/users/';
  var SEARCH_USER_WITH_FOLLOWERS = 'https://api.github.com/search/users?' + tokenPart + 'per_page=100&sort=joined&order=asc&q=';

  return {
    getUsers: getUsers,
    getWhenUserJoined: getWhenUserJoined,
    getUsersWhoJoinedAfter: getUsersWhoJoinedAfter,
    getFollowers: getFollowers
  };

  function getFollowers(user) {
    if (typeof user !== 'string') throw new Error('User has to be identified by login');

    var followersArg = createRequestArgs(USER_DETAILS + user + '/followers?per_page=100&' + tokenPart);

    return githubRequest(followersArg, true)
            .then(combineFollowers)
            .catch(handleError);

    function handleError(reason) {
      if (reason.statusCode === 404) {
        console.log('WARNING: User ' + user + ' is not found');
        return [];
      }
      throw reason;
    }<commit_msg>Should be explicit with users per_page<commit_after>module.exports = githubClient;
var githubRequest = require('./githubRequest.js');

function githubClient(token) {
  var tokenPart = '';
  if (token) tokenPart = 'access_token=' + token + '&';
  var USERS = 'https://api.github.com/users?per_page=100&' + tokenPart + 'since=';
  var USER_DETAILS = 'https://api.github.com/users/';
  var SEARCH_USER_WITH_FOLLOWERS = 'https://api.github.com/search/users?' + tokenPart + 'per_page=100&sort=joined&order=asc&q=';

  return {
    getUsers: getUsers,
    getWhenUserJoined: getWhenUserJoined,
    getUsersWhoJoinedAfter: getUsersWhoJoinedAfter,
    getFollowers: getFollowers
  };

  function getFollowers(user) {
    if (typeof user !== 'string') throw new Error('User has to be identified by login');

    var followersArg = createRequestArgs(USER_DETAILS + user + '/followers?per_page=100&' + tokenPart);

    return githubRequest(followersArg, true)
            .then(combineFollowers)
            .catch(handleError);

    function handleError(reason) {
      if (reason.statusCode === 404) {
        console.log('WARNING: User ' + user + ' is not found');
        return [];
      }
      throw reason;
    }
{'fraction_non_alphanumeric': 0.13445378151260504, 'fraction_numerical': 0.008823529411764706, 'mean_word_length': 3.687007874015748, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, 'https://': 6, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '6094978', 'n_tokens_mistral': 781, 'n_tokens_neox': 739, 'n_words': 157}