<commit_before>const Promise = require('bluebird'),
			prune = require('./utils/prune'),
			find = require('./utils/find'),
			mlb = require('./utils/mlb');

let cornelius = function () {};

cornelius.prototype.searchPlayer = function (options) {
	return new Promise(function (resolve, reject) {
		let error;
		if (!options.query) {
			error = new Error(`searchPlayer - No search query provided.`);
		} else if (typeof(options.query) !== 'string') {
			error = new Error(`searchPlayer - Expected query to be a string, but was given a ${typeof(options.query)}.`);
		}

		if (error) {
			reject(error);
		}

		mlb.search(options)
			.then(data => {
				resolve(data);
			})
			.catch(error => {
				reject(error);
			});

	});
}

cornelius.prototype.get = function (query, key) {
	return new Promise(function (resolve, reject) {
		let error;
		if(!query) {
			error = new Error('No player name provided.')
		} else if (typeof(query) !== 'string') {
			error = new Error(`Expected player name to be a string, but was given a ${typeof(query)}.`);
		} else if (query.split(' ').length < 1) {
			error = new Error(`Full player name required to get player details.`);
		} else if (!key) {
			error = new Error('No key provided.');
		} else if (typeof(key) !== 'string') {
			error = new Error(`Expected key to be a string, but was given a ${typeof(key)}.`);
		}

		if (error) {
			reject(error);
		}

		mlb.search(query)
			.then(function (data) {
				let requestedPlayer = find.player(data, key);
				resolve(requestedPlayer);
			})
			.catch(function (error) {
				reject(error);
			});

	});
}

cornelius.prototype.getHistoric = function (query, key) {
	return new Promise(function (resolve, reject) {
		let error;
		if(!query) {
			error = new Error('No player name provided.')
		} else if (typeof(query) !== 'string') {
			error = new Error(`Expected player name to be a string, but was given a ${typeof(query)}.`);
		} else if (query.split(' ').length < 1) {
			error = new Error(`Full player name required to get player details.`);
		} else if (!key) {
			error = new Error('No key provided.');
		} else if (typeof(key) !== 'string') {
			error = new Error(`Expected key to be a string, but was given a ${typeof(key)}.`);
		}

		if (error) {
			reject(error);
		}

		mlb.search(query, false)
			.then(function (data) {
				let requestedPlayer = find.player(data, key);
				resolve(requestedPlayer);
			})
			.catch(function (error) {
				reject(error);
			});

	});
}

cornelius.prototype.getRoster = function (options) {
	return new Promise(function (resolve, reject) {
		let error;
		if (!options.key) {
			error = new Error('No key provided to getRoster.');
		} else if (options.key.length < 2) {
			error = new Error('Key provided to getRoster is too short.');
		} else if (typeof(options.key) !== 'string') {
			error = new Error(`Expected key to be a string, but was given a ${typeof(options.key)}.`);<commit_msg>searchPlayer now handles getting individuals based on options<commit_after>const Promise = require('bluebird'),
			prune = require('./utils/prune'),
			find = require('./utils/find'),
			mlb = require('./utils/mlb');

let cornelius = function () {};

cornelius.prototype.searchPlayer = function (options) {
	return new Promise(function (resolve, reject) {
		let error;
		if (!options.query) {
			error = new Error(`searchPlayer - No search query provided.`);
		} else if (typeof(options.query) !== 'string') {
			error = new Error(`searchPlayer - Expected query to be a string, but was given a ${typeof(options.query)}.`);
		} else if (options.key && typeof(options.key) !== 'string') {
			error = new Error(`searchPlayer - Expected key to be a string, but was given a ${typeof(options.key)}.`)
		} else if (options.active && typeof(options.active) !== 'boolean') {
			error = new Error(`searchPlayer - Expected active to be a boolean, but was given a ${typeof(options.active)}.`)
		}

		if (error) {
			reject(error);
		}

		mlb.search(options)
			.then(data => {
				if (options.key) {
					let requestedPlayer = find.player(data, options);
					data = requestedPlayer;
				}
				resolve(data);
			})
			.catch(error => {
				reject(error);
			});

	});
}

cornelius.prototype.getRoster = function (options) {
	return new Promise(function (resolve, reject) {
		let error;
		if (!options.key) {
			error = new Error('No key provided to getRoster.');
		} else if (options.key.length < 2) {
			error = new Error('Key provided to getRoster is too short.');
		} else if (typeof(options.key) !== 'string') {
			error = new Error(`Expected key to be a string, but was given a ${typeof(options.key)}.`);
{'fraction_non_alphanumeric': 0.16161178509532062, 'fraction_numerical': 0.0008665511265164644, 'mean_word_length': 3.504390243902439, 'pattern_counts': {'":': 0, '<': 7, '<?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': '150606', 'n_tokens_mistral': 1648, 'n_tokens_neox': 1459, 'n_words': 445}