<commit_before>/**
 * Loads a tiered set of scripts asynchronously. Includes the option to load fallback scripts as well.
 * @param scriptsToLoad An array of arrays of scripts to load.
 * @param onLoaded a callback that is called once ALL scripts have finished loading.
 */
function scriptLoader(scriptsToLoad, onLoaded) {
	//Prevents duplicate requests since the onerror event fires twice.
	var requests = {};

	var importScript = function (src, onSuccess, onError) {
		if(!!requests[src]) {
			return;
		}

		console.log('src = ' + src);

		var scriptElement   = document.createElement('script');
		scriptElement.src   = src;
		scriptElement.async = false;

		if (onError) {
			scriptElement.onerror = onError;
		}

		if (onSuccess) {
			scriptElement.onload = onSuccess;
		}

		document.head.appendChild(scriptElement);
		requests[src] = true;

		return scriptElement;
	};

	var loadAsync = function (asyncScripts, callback) {
		var counter = asyncScripts.length;
		asyncScripts.forEach(function (scriptObject) {
			importScript(scriptObject.primaryUrl, function (event) {
				console.log('Loaded Primary: ' + scriptObject.primaryUrl);
				counter--;
			}, function () {
				if(!!scriptObject.secondaryUrl) {
					importScript(scriptObject.secondaryUrl, function () {
						console.log('Loaded Secondary: ' + scriptObject.secondaryUrl);
						counter--;
					}, function() {
						counter--;
					});
				} else {
					counter--;
				}
			});
		});

		(function loop() {
			setTimeout(function () {
				if (counter > 0) {
					console.log('counter Check: ' + counter);
					loop();
				} else {
					callback();
				}
			}, 500);
		})();
	};

	var loadSync = function (syncScripts, callback) {
		var previousFunction = callback;
		for (var j = (syncScripts.length - 1); j >= 0; j--) {

			var asyncScripts = syncScripts[j];
			previousFunction  = (function (item, prevFunction) {
				return function () {
					loadAsync(item, function() {<commit_msg>Removed console.log<commit_after>/**
 * Loads a tiered set of scripts asynchronously. Includes the option to load fallback scripts as well.
 * @param scriptsToLoad An array of arrays of scripts to load.
 * @param onLoaded a callback that is called once ALL scripts have finished loading.
 */
function scriptLoader(scriptsToLoad, onLoaded) {
	//Prevents duplicate requests since the onerror event fires twice.
	var requests = {};

	var importScript = function (src, onSuccess, onError) {
		if(!!requests[src]) {
			return;
		}

		var scriptElement   = document.createElement('script');
		scriptElement.src   = src;
		scriptElement.async = false;

		if (onError) {
			scriptElement.onerror = onError;
		}

		if (onSuccess) {
			scriptElement.onload = onSuccess;
		}

		document.head.appendChild(scriptElement);
		requests[src] = true;

		return scriptElement;
	};

	var loadAsync = function (asyncScripts, callback) {
		var counter = asyncScripts.length;
		asyncScripts.forEach(function (scriptObject) {
			importScript(scriptObject.primaryUrl, function (event) {
				counter--;
			}, function () {
				if(!!scriptObject.secondaryUrl) {
					importScript(scriptObject.secondaryUrl, function () {
						counter--;
					}, function() {
						counter--;
					});
				} else {
					counter--;
				}
			});
		});

		(function loop() {
			setTimeout(function () {
				if (counter > 0) {
					loop();
				} else {
					callback();
				}
			}, 500);
		})();
	};

	var loadSync = function (syncScripts, callback) {
		var previousFunction = callback;
		for (var j = (syncScripts.length - 1); j >= 0; j--) {

			var asyncScripts = syncScripts[j];
			previousFunction  = (function (item, prevFunction) {
				return function () {
					loadAsync(item, function() {
{'fraction_non_alphanumeric': 0.12726290191840042, 'fraction_numerical': 0.0032423669278573357, 'mean_word_length': 3.250287026406429, 'pattern_counts': {'":': 0, '<': 3, '<?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': '2793691', 'n_tokens_mistral': 1339, 'n_tokens_neox': 1089, 'n_words': 296}