<commit_before>
getMember = function(members, user) {
	if (!members) return false;
	var member = false;
	members.forEach(function(member_candidate) {
		if (member_candidate.user == user) {
			member = member_candidate;
			return true; // break
		}
	});
	return member;
};


/* Get a username from ID
 *
 * It tries hard to give a sensible response; incognito ids get represented by an incognito string, unless the user employing that incognito-ID is currently logged in.
 */
userName = function() {
	// We cache the username lookups
	// To prevent unlimited cache-growth, after a enough lookups we
	// build a new cache from the old
	var cacheLimit = 1000;
	var cache = {};
	var previousCache = {};
	var lookups = 0;
	var pending = {};

	return function(userId) {
		if (!userId) return mf('noUser_placeholder', 'someone');

		if (userId.substr(0, 5)  == 'Anon_') {
			var loggeduser = Meteor.user();
			if (loggeduser && loggeduser.anonId && loggeduser.anonId.indexOf(userId) != -1) {
				return  '☔ ' + loggeduser.username + ' ☔';
			}
			return "☔ incognito";
		}

		// Consult cache
		var user = cache[userId];
		if (user === undefined) {
			// Consult old cache<commit_msg>use client-side collection to keep cache updated<commit_after>
getMember = function(members, user) {
	if (!members) return false;
	var member = false;
	members.forEach(function(member_candidate) {
		if (member_candidate.user == user) {
			member = member_candidate;
			return true; // break
		}
	});
	return member;
};


/* Get a username from ID
 *
 * It tries hard to give a sensible response; incognito ids get represented by an incognito string, unless the user employing that incognito-ID is currently logged in.
 */
userName = function() {
	// We cache the username lookups
	// To prevent unlimited cache-growth, after a enough lookups we
	// build a new cache from the old
	var cacheLimit = 1000;
	var cache = {};
	var previousCache = {};
	var lookups = 0;
	var pending = {};

	// Update the cache if users are pushed to the collection
	Meteor.users.find().observe({
		'added': function(user) {
			cache[user._id] = user.username;
		},
		'changed': function(user) {
			cache[user._id] = user.username;
		}
	});

	return function(userId) {
		if (!userId) return mf('noUser_placeholder', 'someone');

		if (userId.substr(0, 5)  == 'Anon_') {
			var loggeduser = Meteor.user();
			if (loggeduser && loggeduser.anonId && loggeduser.anonId.indexOf(userId) != -1) {
				return  '☔ ' + loggeduser.username + ' ☔';
			}
			return "☔ incognito";
		}

		// Consult cache
		var user = cache[userId];
		if (user === undefined) {
			// Consult old cache
{'fraction_non_alphanumeric': 0.12957317073170732, 'fraction_numerical': 0.006097560975609756, 'mean_word_length': 3.4795221843003414, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, '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': '5033479', 'n_tokens_mistral': 925, 'n_tokens_neox': 838, 'n_words': 274}