<commit_before>let prune = function () {}

prune.prototype.searchResults = function (data) {
	let resultsCount = data.search_player_all.queryResults.totalSize;
	let prunedResults = [];
	
	if (resultsCount > 1) {
		let searchResults = data.search_player_all.queryResults.row;

		for (let i = 0; i < searchResults.length; i++) {
			let player = searchResults[i];
			let prunedPlayer = this.playerData(player);
			prunedResults.push(prunedPlayer);
		}
	} else {
		let player = data.search_player_all.queryResults.row;
		let prunedPlayer = this.playerData(player);

		prunedResults.push(prunedPlayer);
	}

	return prunedResults;
}

prune.prototype.playerData = function (data) {
	let player = {
		id: data.player_id,
		name: {
			full: data.name_display_first_last,
			first: data.name_first,
			last: data.name_last,
			roster: data.name_display_roster
		},
		position: {
			id: data.position_id,
			code: data.position
		},
		team: {
			id: data.team_id,
			name: data.team_full,
			abbrev: data.team_abbrev,
			code: data.team_code,
			league: data.league
		},
		date: {
			pro_debut: data.pro_debut_date,
			birth: data.birth_date
		},
		geo: {
			city: data.birth_city,
			state: data.birth_city,
			country: data.birth_country,
			high_school: data.high_school,
			college: data.college
		},
		attribute: {
			bats: data.bats,
			throws: data.throws,
			weight: data.weight,
			height: {
				feet: data.height_feet,
				inches: data.height_inches
			}
		}
	};

	return player;
}

prune.prototype.playerStats = function (data) {
	let prunedData;
	let isHittingStats = data.hasOwnProperty('sport_hitting_tm');

	if (isHittingStats) {
		prunedData  = data.sport_hitting_tm.queryResults.row;
	} else {
		prunedData = data.sport_pitching_tm.queryResults.row;
	}
	
	return prunedData;
}

prune.prototype.rosterData = function (data) {
	let prunedData = [];
	let roster = data.roster_all.queryResults.row;

	roster.forEach(function (player) {
		let name = player.player_html;
		name = name.replace(/\,/g,"").split(' ').reverse().join(' ');
		let prunedPlayer = {
			id: player.player_id,
			name: name
		}
		prunedData.push(prunedPlayer);
	});

	return prunedData;
}

module.exports = new prune;<commit_msg>remove string replace for roster pruning<commit_after>let prune = function () {}

prune.prototype.searchResults = function (data) {
	let resultsCount = data.search_player_all.queryResults.totalSize;
	let prunedResults = [];
	
	if (resultsCount > 1) {
		let searchResults = data.search_player_all.queryResults.row;

		for (let i = 0; i < searchResults.length; i++) {
			let player = searchResults[i];
			let prunedPlayer = this.playerData(player);
			prunedResults.push(prunedPlayer);
		}
	} else {
		let player = data.search_player_all.queryResults.row;
		let prunedPlayer = this.playerData(player);

		prunedResults.push(prunedPlayer);
	}

	return prunedResults;
}

prune.prototype.playerData = function (data) {
	let player = {
		id: data.player_id,
		name: {
			full: data.name_display_first_last,
			first: data.name_first,
			last: data.name_last,
			roster: data.name_display_roster
		},
		position: {
			id: data.position_id,
			code: data.position
		},
		team: {
			id: data.team_id,
			name: data.team_full,
			abbrev: data.team_abbrev,
			code: data.team_code,
			league: data.league
		},
		date: {
			pro_debut: data.pro_debut_date,
			birth: data.birth_date
		},
		geo: {
			city: data.birth_city,
			state: data.birth_city,
			country: data.birth_country,
			high_school: data.high_school,
			college: data.college
		},
		attribute: {
			bats: data.bats,
			throws: data.throws,
			weight: data.weight,
			height: {
				feet: data.height_feet,
				inches: data.height_inches
			}
		}
	};

	return player;
}

prune.prototype.playerStats = function (data) {
	let prunedData;
	let isHittingStats = data.hasOwnProperty('sport_hitting_tm');

	if (isHittingStats) {
		prunedData  = data.sport_hitting_tm.queryResults.row;
	} else {
		prunedData = data.sport_pitching_tm.queryResults.row;
	}
	
	return prunedData;
}

prune.prototype.rosterData = function (data) {
	let prunedData = [];
	let roster = data.roster_all.queryResults.row;

	roster.forEach(function (player) {
		let prunedPlayer = {
			id: player.player_id,
			name: player.name_display_first_last
		}
		prunedData.push(prunedPlayer);
	});

	return prunedData;
}

module.exports = new prune;
{'fraction_non_alphanumeric': 0.1213302752293578, 'fraction_numerical': 0.0009174311926605505, 'mean_word_length': 3.771334792122538, 'pattern_counts': {'":': 0, '<': 5, '<?xml version=': 0, '>': 5, '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': '5860779', 'n_tokens_mistral': 1840, 'n_tokens_neox': 1579, 'n_words': 294}