<commit_before>"use strict";

var HTTP = 
{
	get : function(url, cb)
	{
		HTTP.REQUEST("GET", url, undefined, cb);
	},

	put : function(url, data, cb)
	{
		HTTP.REQUEST("PUT", url, data, cb);
	},

	post : function(url, data, cb)
	{
		HTTP.REQUEST("POST", url, data, cb);
	},

	REQUEST : function(method, url, data, cb)
	{
		var xhr = new XMLHttpRequest();
		xhr.open(method, url, true);
		
		if(data)
		{
			xhr.setRequestHeader("Content-type", "application/json; charset=UTF-8");
			xhr.send(JSON.stringify(data));
		}
		else
		{
			xhr.send();
		}

		xhr.onreadystatechange = function(o)
		{
			if(xhr.readyState===4 && cb)
				cb(xhr.responseText);
		};
	}
};<commit_msg>The HTTP callback now behaves like node callbacks with an error parameter first<commit_after>"use strict";

(function() {
	function httpRequest(method, url, data, cb)
	{
		var xhr = new XMLHttpRequest();
		xhr.open(method, url, true);
		
		if(data)
		{
			xhr.setRequestHeader("Content-type", "application/json; charset=UTF-8");
			xhr.send(JSON.stringify(data));
		}
		else
		{
			xhr.send();
		}

		xhr.onreadystatechange = function(o)
		{
			if(xhr.readyState===4 && cb)
				setImmediate(cb, undefined, xhr.responseText);
		};
	}

	var HTTP = 
	{
		get : function(url, cb)
		{
			httpRequest("GET", url, undefined, cb);
		},

		put : function(url, data, cb)
		{
			httpRequest("PUT", url, data, cb);
		},

		post : function(url, data, cb)
		{
			httpRequest("POST", url, data, cb);
		}
	};

	window.HTTP = HTTP;
})();

{'fraction_non_alphanumeric': 0.17725752508361203, 'fraction_numerical': 0.0026755852842809363, 'mean_word_length': 3.374269005847953, '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': '851451', 'n_tokens_mistral': 655, 'n_tokens_neox': 571, 'n_words': 119}