<commit_before>const matcher = /^(([a-zA-Z-]+):\/*?)([a-zA-Z.@-]+)(:([0-9]{2,}))?(\/?[a-zA-Z0-9._~:/?#[\]%@!$&'()*+,;=-]*?)??(\?([a-zA-Z0-9._~:/?#[\]%@!$&'()*+,;=-]*))?$/;

exports.Url = function(url){

	const queryObject = {};
	const queryProxy = new Proxy(queryObject, {
		get: (target, key) => {
			return target[key];
		},
		set: (target, key, value) => {
			if(value){
				target[key] = value.toString();
			}else{
				delete target[key];
			}
		},
		deleteProperty: (target, key) => {
			delete target[key];
		},
		enumerate: (target) => {
			return Object.assign({}, target);
		},
		ownKeys: (target) => {
			return Reflect.ownKeys(target);
		},
		has: (target, key) => {
			return key in target;
		},
		getOwnPropertyDescriptor: (target, key) => {
			let value = target[key];
			return value ? {
				value: value,
				writable: true,
				enumerable: true,
				configurable: true,
			} : undefined;
		},
	});

	const parseQuery = (queryString) => {
		for(let key in queryObject){
			delete queryObject[key];
		}

		if(typeof queryString !== 'undefined'){
			queryString.split('&').forEach(function(x){
				if(!x || x === ''){
					return;
				}
				let q = x.match(/(.+?)=(.*)/); //Need to use this instead of .split() in case the value contains an "="
				queryObject[q[1]] = q[2];
			});
		}

		return queryObject;
	};

	const stringifyQuery = (query) => {
		let a = [];
		for(let q in query){
			a.push(q + '=' + (query[q] || ''));
		}
		return a.join('&');
	};
    
	const defPorts = {
		'http': '80',
		'https': '443'
	};
    
	let protocol, domain, port, path, query;
    
	const parse = function(url){
		let matches = url.match(matcher);
		protocol = matches[2];<commit_msg>Moved variable definitions to top of function<commit_after>const matcher = /^(([a-zA-Z-]+):\/*?)([a-zA-Z.@-]+)(:([0-9]{2,}))?(\/?[a-zA-Z0-9._~:/?#[\]%@!$&'()*+,;=-]*?)??(\?([a-zA-Z0-9._~:/?#[\]%@!$&'()*+,;=-]*))?$/;

exports.Url = function(url){

	let protocol, domain, port, path, query;
	const queryObject = {};
	const defPorts = {
		'http': '80',
		'https': '443'
	};

	const queryProxy = new Proxy(queryObject, {
		get: (target, key) => {
			return target[key];
		},
		set: (target, key, value) => {
			if(value){
				target[key] = value.toString();
			}else{
				delete target[key];
			}
		},
		deleteProperty: (target, key) => {
			delete target[key];
		},
		enumerate: (target) => {
			return Object.assign({}, target);
		},
		ownKeys: (target) => {
			return Reflect.ownKeys(target);
		},
		has: (target, key) => {
			return key in target;
		},
		getOwnPropertyDescriptor: (target, key) => {
			let value = target[key];
			return value ? {
				value: value,
				writable: true,
				enumerable: true,
				configurable: true,
			} : undefined;
		},
	});

	const parseQuery = (queryString) => {
		for(let key in queryObject){
			delete queryObject[key];
		}

		if(typeof queryString !== 'undefined'){
			queryString.split('&').forEach(function(x){
				if(!x || x === ''){
					return;
				}
				let q = x.match(/(.+?)=(.*)/); //Need to use this instead of .split() in case the value contains an "="
				queryObject[q[1]] = q[2];
			});
		}

		return queryObject;
	};

	const stringifyQuery = (query) => {
		let a = [];
		for(let q in query){
			a.push(q + '=' + (query[q] || ''));
		}
		return a.join('&');
	};
    
	const parse = function(url){
		let matches = url.match(matcher);
		protocol = matches[2];
{'fraction_non_alphanumeric': 0.23889379229185054, 'fraction_numerical': 0.0088261253309797, 'mean_word_length': 3.0380047505938244, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 21, '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': '1110211', 'n_tokens_mistral': 1525, 'n_tokens_neox': 1299, 'n_words': 271}