<commit_before>'use strict';
function Datagram(self) {
	
	function fill (query) {
		function keyRepresentsSingleValue(item) {
			var isSame;
			if(item[self.fieldMap[key]] instanceof Date) {
				isSame = item[self.fieldMap[key]].valueOf() === query[0][self.fieldMap[key]].valueOf();
			}
			else {
				isSame = item[self.fieldMap[key]] === query[0][self.fieldMap[key]];
			}
			return isSame;
		}

		for(var key in self.fieldMap) {
			if(query.every(keyRepresentsSingleValue)) {
				if(typeof self.fieldMap[key] === 'string') {
					self[key] = query[0][self.fieldMap[key]];
				}
				else {
					self[key] = self.fieldMap[key];
					self[key].fill(query);
				}
			}
			else {
				throw new Error('Query pased to Datagram contains more than one possible value for: ' + self.fieldMap[key]);
			}
			
		}
	}
	
	function has(key, type) {
		if(self[key]) {
			if(self[key] instanceof Dataset) {	
				return self[key].typeName === type;
			}
			else {
				return self[key].constructor.name === type;
			}
		}
		else {
			return false;
		}
	}

	Object.defineProperty(this,'has',{value:has, writable:false,configurable:true,enumerable:false});
	Object.defineProperty(this,'fill',{value:fill, writable:false,configurable:true,enumerable:false});
	Object.defineProperty(this,'fieldMap',{writable:true,enumerable:false});
	Object.defineProperty(this,'endPoint',{writable:true,enumerable:false});
}
exports.Datagram = Datagram;


function Dataset() {
	var arr = [];
	arr.push.apply(arr, arguments);
	arr.__proto__ = Dataset.prototype;

	function copyReturn(source, destination) {
		source.forEach(function(value) {
			destination.push(value);
		});
		return destination;
	}

	Object.defineProperty(arr,'copyReturn',{value:copyReturn,writable:false,configurable:false,enumerable:false});
	Object.defineProperty(arr,'key',{writable:true,configurable:true,enumerable:false});
	Object.defineProperty(arr,'items',{writable:true,configurable:true,enumerable:false});
	Object.defineProperty(arr,'typeName',{writable:true,configurable:true,enumerable:false});
	return arr;
}
Dataset.prototype = [];

Dataset.prototype.fill = function(query) {
	var self = this;
	function splitQuery(splits, item, idx, array) {
		if(self.key) {
			if(idx === 0 || item[self.key]!== array[idx-1][self.key]) {
				splits.push([]);
			}

			splits[splits.length -1].push(item);
			return splits;
		}
		else {
			throw new Error('Can not process Dataset - Key not defined');
		}
	}

	function sortFunction(a,b) {
		if (a[self.key] > b[self.key]) {
			return 1;
		}
		if (a[self.key] < b[self.key]) {
			return -1;
		}
		return 0;
	}

	query = query.sort(sortFunction);
	var split = query.reduce(splitQuery,[]);

	for(var i = 0;i < split.length; i++) {
		var item = self.items();
		item.fill(split[i]);
		self.push(item);
	}
};

Dataset.prototype.has = function(type) {
	var self = this;
	function checkForSame(item) {
		if(item instanceof Dataset) {	
			return item.typeName === type;
		}
		else {
			return item.constructor.name === type;
		}
	}
	return self.every(checkForSame);
};
exports.Dataset = Dataset;
<commit_msg>Updated Dataset for consistency<commit_after>'use strict';
function Datagram(self) {
	
	function fill (query) {
		function keyRepresentsSingleValue(item) {
			var isSame;
			if(item[self.fieldMap[key]] instanceof Date) {
				isSame = item[self.fieldMap[key]].valueOf() === query[0][self.fieldMap[key]].valueOf();
			}
			else {
				isSame = item[self.fieldMap[key]] === query[0][self.fieldMap[key]];
			}
			return isSame;
		}

		for(var key in self.fieldMap) {
			if(query.every(keyRepresentsSingleValue)) {
				if(typeof self.fieldMap[key] === 'string') {
					self[key] = query[0][self.fieldMap[key]];
				}
				else {
					self[key] = self.fieldMap[key];
					self[key].fill(query);
				}
			}
			else {
				throw new Error('Query pased to Datagram contains more than one possible value for: ' + self.fieldMap[key]);
			}
			
		}
	}
	
	function has(key, type) {
		if(self[key]) {
			if(self[key] instanceof Dataset) {	
				return self[key].typeName === type;
			}
			else {
				return self[key].constructor.name === type;
			}
		}
		else {
			return false;
		}
	}

	Object.defineProperty(this,'has',{value:has, writable:false,configurable:true,enumerable:false});
	Object.defineProperty(this,'fill',{value:fill, writable:false,configurable:true,enumerable:false});
	Object.defineProperty(this,'fieldMap',{writable:true,enumerable:false});
	Object.defineProperty(this,'endPoint',{writable:true,enumerable:false});
}
exports.Datagram = Datagram;


function Dataset() {
	var arr = [];
	arr.push.apply(arr, arguments);
	arr.__proto__ = Dataset.prototype;

	function copyReturn(source, destination) {
		source.forEach(function(value) {
			destination.push(value);
		});
		return destination;
	}

	function fill(query) {
		var self = this;
		function splitQuery(splits, item, idx, array) {
			if(self.key) {
				if(idx === 0 || item[self.key]!== array[idx-1][self.key]) {
					splits.push([]);
				}

				splits[splits.length -1].push(item);
				return splits;
			}
			else {
				throw new Error('Can not process Dataset - Key not defined');
			}
		}

		function sortFunction(a,b) {
			if (a[self.key] > b[self.key]) {
				return 1;
			}
			if (a[self.key] < b[self.key]) {
				return -1;
			}
			return 0;
		}

		query = query.sort(sortFunction);
		var split = query.reduce(splitQuery,[]);

		for(var i = 0;i < split.length; i++) {
			var item = self.items();
			item.fill(split[i]);
			self.push(item);
		}
	}

	function has(type) {
		var self = this;
		function checkForSame(item) {
			if(item instanceof Dataset) {	
				return item.typeName === type;
			}
			else {
				return item.constructor.name === type;
			}
		}
		return self.every(checkForSame);
	}

	Object.defineProperty(arr,'copyReturn',{value:copyReturn,writable:false,configurable:false,enumerable:false});
	Object.defineProperty(arr,'has',{value:has, writable:false,configurable:false,enumerable:false});
	Object.defineProperty(arr,'fill',{value:fill, writable:false,configurable:false,enumerable:false});
	Object.defineProperty(arr,'key',{writable:true,configurable:true,enumerable:false});
	Object.defineProperty(arr,'items',{writable:true,configurable:true,enumerable:false});
	Object.defineProperty(arr,'typeName',{writable:true,configurable:true,enumerable:false});

	return arr;
}
Dataset.prototype = [];

exports.Dataset = Dataset;

{'fraction_non_alphanumeric': 0.16408329419132614, 'fraction_numerical': 0.003131360576170346, 'mean_word_length': 4.327773144286906, 'pattern_counts': {'":': 0, '<': 7, '<?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': '5847394', 'n_tokens_mistral': 2544, 'n_tokens_neox': 2205, 'n_words': 365}