<commit_before>require! {
	'../models/user-following': UserFollowing
}

exports = (user-id, limit, since-id, max-id, callback) ->
	function query-callback(err, statuses)
		callback statuses
	UserFollowing.find { follower-id: user-id }, (followings) ->
		| followings? =>
			followings-ids = [user-id] # Get my statuses
			followings.for-each (following) ->
				followings-ids.push following.followee-id.to-string!
			query = switch
				| !since-id? and !max-id? => { user-id: { $in: followings-ids } }
				| since-id? => { $and: [ user-id: { $in: followings-ids }, id: { $gt: since-id } ] }
				| max-id? => { $and: [ user-id: { $in: followings-ids }, id: { $lt: max-id } ] }
			Status
				.find query
				.sort \-created-at # Desc
				.limit limit
				.exec query-callback
		| _ => callback null<commit_msg>Improve readability<commit_after>import require \prelude-ls

require! {
	'../models/user-following': UserFollowing
}

exports = (user-id, limit, since-id, max-id, callback) ->
	function query-callback(err, statuses)
		callback statuses
	UserFollowing.find { follower-id: user-id }, (followings) ->
		| followings? =>
			followings-ids = [user-id] ++ (followings |> map (following) -> following.followee-id.to-string!)
			query = switch
				| !since-id? and !max-id? => { user-id: { $in: followings-ids } }
				| since-id? => { $and: [ user-id: { $in: followings-ids }, id: { $gt: since-id } ] }
				| max-id? => { $and: [ user-id: { $in: followings-ids }, id: { $lt: max-id } ] }
			Status
				.find query
				.sort \-created-at # Desc
				.limit limit
				.exec query-callback
		| _ => callback null
{'fraction_non_alphanumeric': 0.1822139303482587, 'fraction_numerical': 0.0, 'mean_word_length': 2.9728395061728397, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 20, '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': '2625802', 'n_tokens_mistral': 654, 'n_tokens_neox': 575, 'n_words': 128}