<commit_before>const Twitter = require('twitter');
const moment = require('moment');
const KEYS = require('./keys');

const twitterClient = new Twitter({
  consumer_key: KEYS.twitter.consumer_key,
  consumer_secret: KEYS.twitter.consumer_secret,
  access_token_key: KEYS.twitter.access_token_key,
  access_token_secret: KEYS.twitter.access_token_secret
});

module.exports.getTweetsForHashtags = function(hashtagsArray) {
	let hashtagsQuery = hashtagsArray.join(' OR ');
	console.log('requesting tweets for hashtags ' + hashtagsQuery);
	return new Promise((resolve, reject) => {
		twitterClient.get('search/tweets', {q: hashtagsQuery}, function(error, tweets, response) {
		   if (error) {
				 reject(error);
				 return null;
			 }

			 console.log('tweets received');
			 resolve(tweets, response);
		});
	})
}

module.exports.patchStatuses = function(twitterStatuses) {
	if (!(twitterStatuses instanceof Array) || twitterStatuses.length == 0) {
		return [];
	}

	twitterStatuses.forEach(status => {
		status.created_at_relative = moment(new Date(status.created_at)).fromNow();
	});
}
<commit_msg>Limit number of tweets to 9<commit_after>const Twitter = require('twitter');
const moment = require('moment');
const KEYS = require('./keys');

const twitterClient = new Twitter({
  consumer_key: KEYS.twitter.consumer_key,
  consumer_secret: KEYS.twitter.consumer_secret,
  access_token_key: KEYS.twitter.access_token_key,
  access_token_secret: KEYS.twitter.access_token_secret
});

module.exports.getTweetsForHashtags = function(hashtagsArray) {
	let hashtagsQuery = hashtagsArray.join(' OR ');
	console.log('requesting tweets for hashtags ' + hashtagsQuery);
	return new Promise((resolve, reject) => {
		twitterClient.get('search/tweets', {q: hashtagsQuery, count: 9}, function(error, tweets, response) {
		   if (error) {
				 reject(error);
				 return null;
			 }

			 console.log('tweets received');
			 resolve(tweets, response);
		});
	})
}

module.exports.patchStatuses = function(twitterStatuses) {
	if (!(twitterStatuses instanceof Array) || twitterStatuses.length == 0) {
		return [];
	}

	twitterStatuses.forEach(status => {
		status.created_at_relative = moment(new Date(status.created_at)).fromNow();
	});
}

{'fraction_non_alphanumeric': 0.1366906474820144, 'fraction_numerical': 0.0017985611510791368, 'mean_word_length': 5.215083798882682, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 7, 'https://': 0, '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': '610521', 'n_tokens_mistral': 763, 'n_tokens_neox': 685, 'n_words': 135}