<commit_before>(function(){
	"use strict";

	luga.namespace("luga.router.utils");

	/*
	 Lovingly adapted from Crossroads.js
	 https://millermedeiros.github.io/crossroads.js/
	 */

	// Leading and trailing slashes
	var SLASHES_REGEXP = /^\/|\/$/g;

	// Params:  everything between "{ }" or ": :"
	var PARAMS_REGEXP = /(?:\{|:)([^}:]+)(?:\}|:)/g;

	// Save params during compile (avoid escaping things that shouldn't be escaped)
	var TOKENS = {
		OS: {
			// Optional slashes
			// Slash between "::" or "}:" or "\w:" or ":{?" or "}{?" or "\w{?"
			rgx: /([:}]|\w(?=\/))\/?(:|(?:\{\?))/g,
			save: "$1{{id}}$2",
			res: "\\/?"
		},
		RS: {
			// Required slashes
			// Used to insert slash between ":{" and "}{"
			rgx: /([:}])\/?(\{)/g,
			save: "$1{{id}}$2",
			res: "\\/"
		},
		RQ: {
			// Required query string: everything in between "{? }"
			rgx: /\{\?([^}]+)\}/g,
			// Everything from "?" till "#" or end of string
			res: "\\?([^#]+)"
		},
		OQ: {
			// Optional query string: everything in between ":? :"
			rgx: /:\?([^:]+):/g,
			// Everything from "?" till "#" or end of string
			res: "(?:\\?([^#]*))?"
		},
		OR: {
			// Optional rest: everything in between ": *:"
			rgx: /:([^:]+)\*:/g,
			res: "(.*)?" // Optional group to avoid passing empty string as captured
		},
		RR: {
			// Rest param: everything in between "{ *}"
			rgx: /\{([^}]+)\*\}/g,
			res: "(.+)"
		},
		// Required/optional params should come after rest segments
		RP: {
			// Required params: everything between "{ }"
			rgx: /\{([^}]+)\}/g,
			res: "([^\\/?]+)"
		},
		OP: {
			// Optional params: everything between ": :"
			rgx: /:([^:]+):/g,
			res: "([^\\/?]+)?\/?"
		}
	};

	for(var key in TOKENS){
		/* istanbul ignore else */
		if(TOKENS.hasOwnProperty(key) === true){
			var current = TOKENS[key];
			current.id = "__CR_" + key + "__";
			current.save = ("save" in current) ? current.save.replace("{{id}}", current.id) : current.id;
			current.rRestore = new RegExp(current.id, "g");
		}
	}

	function replaceTokens(pattern, regexpName, replaceName){
		for(var key in TOKENS){
			/* istanbul ignore else */
			if(TOKENS.hasOwnProperty(key) === true){
				var current = TOKENS[key];
				pattern = pattern.replace(current[regexpName], current[replaceName]);
			}
		}
		return pattern;
	}

	/**
	 * Turn a path into a regular expression
	 * @param {string} path
	 * @returns {regExp}
	 */
	luga.router.utils.compilePath = function(path){

		// Remove leading and trailing slashes, if any
		var pattern = path.replace(SLASHES_REGEXP, "");

		// Save tokens
		pattern = replaceTokens(pattern, "rgx", "save");
		// Restore tokens
		pattern = replaceTokens(pattern, "rRestore", "res");

		// Add optional leading and trailing slashes
		pattern = "\\/?" + pattern + "\\/?";

		return new RegExp("^" + pattern + "$");
	};

	/**
	 * Extract matching values out of a given path using a specified RegExp
	 * @param {regExp} regex
	 * @param  {string} path
	 * @returns {array}
	 */
	function extractValues(regex, path){
		var values = [];
		var match;
		// Reset lastIndex since RegExp can have "g" flag thus multiple runs might affect the result
		regex.lastIndex = 0;
		while((match = regex.exec(path)) !== null){
			values.push(match[1]);
		}
		return values;
	}

	/**
	 * Extract an array of id out of a given path
	 * @param {string} path
	 * @returns {array}
	 */
	luga.router.utils.getParamIds = function(path){
		return extractValues(PARAMS_REGEXP, path);
	};

	/**
	 * Extract an array of values out of a given path using a RegExp
	 * @param {string} path
	 * @param {regExp} regex
	 * @returns {array}
	 */
	luga.router.utils.getParamValues = function(path, regex){
		var values = regex.exec(path);
		/* istanbul ignore else */
		if(values !== null){
			// We want a plain vanilla array, normalize the result object
			values.shift();
			delete values.index;
			delete values.input;
		}
		return values;
	};

}());<commit_msg>Replaced magic string<commit_after>(function(){
	"use strict";

	luga.namespace("luga.router.utils");

	/*
	 Lovingly adapted from Crossroads.js
	 https://millermedeiros.github.io/crossroads.js/
	 */

	// Leading and trailing slashes
	var SLASHES_REGEXP = /^\/|\/$/g;

	// Params:  everything between "{ }" or ": :"
	var PARAMS_REGEXP = /(?:\{|:)([^}:]+)(?:\}|:)/g;

	// Save params during compile (avoid escaping things that shouldn't be escaped)
	var TOKENS = {
		OS: {
			// Optional slashes
			// Slash between "::" or "}:" or "\w:" or ":{?" or "}{?" or "\w{?"
			rgx: /([:}]|\w(?=\/))\/?(:|(?:\{\?))/g,
			save: "$1{{id}}$2",
			res: "\\/?"
		},
		RS: {
			// Required slashes
			// Used to insert slash between ":{" and "}{"
			rgx: /([:}])\/?(\{)/g,
			save: "$1{{id}}$2",
			res: "\\/"
		},
		RQ: {
			// Required query string: everything in between "{? }"
			rgx: /\{\?([^}]+)\}/g,
			// Everything from "?" till "#" or end of string
			res: "\\?([^#]+)"
		},
		OQ: {
			// Optional query string: everything in between ":? :"
			rgx: /:\?([^:]+):/g,
			// Everything from "?" till "#" or end of string
			res: "(?:\\?([^#]*))?"
		},
		OR: {
			// Optional rest: everything in between ": *:"
			rgx: /:([^:]+)\*:/g,
			res: "(.*)?" // Optional group to avoid passing empty string as captured
		},
		RR: {
			// Rest param: everything in between "{ *}"
			rgx: /\{([^}]+)\*\}/g,
			res: "(.+)"
		},
		// Required/optional params should come after rest segments
		RP: {
			// Required params: everything between "{ }"
			rgx: /\{([^}]+)\}/g,
			res: "([^\\/?]+)"
		},
		OP: {
			// Optional params: everything between ": :"
			rgx: /:([^:]+):/g,
			res: "([^\\/?]+)?\/?"
		}
	};

	for(var key in TOKENS){
		/* istanbul ignore else */
		if(TOKENS.hasOwnProperty(key) === true){
			var current = TOKENS[key];
			current.id = "__LUGA_" + key + "__";
			current.save = ("save" in current) ? current.save.replace("{{id}}", current.id) : current.id;
			current.rRestore = new RegExp(current.id, "g");
		}
	}

	function replaceTokens(pattern, regexpName, replaceName){
		for(var key in TOKENS){
			/* istanbul ignore else */
			if(TOKENS.hasOwnProperty(key) === true){
				var current = TOKENS[key];
				pattern = pattern.replace(current[regexpName], current[replaceName]);
			}
		}
		return pattern;
	}

	/**
	 * Turn a path into a regular expression
	 * @param {string} path
	 * @returns {regExp}
	 */
	luga.router.utils.compilePath = function(path){

		// Remove leading and trailing slashes, if any
		var pattern = path.replace(SLASHES_REGEXP, "");

		// Save tokens
		pattern = replaceTokens(pattern, "rgx", "save");
		// Restore tokens
		pattern = replaceTokens(pattern, "rRestore", "res");

		// Add optional leading and trailing slashes
		pattern = "\\/?" + pattern + "\\/?";

		return new RegExp("^" + pattern + "$");
	};

	/**
	 * Extract matching values out of a given path using a specified RegExp
	 * @param {regExp} regex
	 * @param  {string} path
	 * @returns {array}
	 */
	function extractValues(regex, path){
		var values = [];
		var match;
		// Reset lastIndex since RegExp can have "g" flag thus multiple runs might affect the result
		regex.lastIndex = 0;
		while((match = regex.exec(path)) !== null){
			values.push(match[1]);
		}
		return values;
	}

	/**
	 * Extract an array of id out of a given path
	 * @param {string} path
	 * @returns {array}
	 */
	luga.router.utils.getParamIds = function(path){
		return extractValues(PARAMS_REGEXP, path);
	};

	/**
	 * Extract an array of values out of a given path using a RegExp
	 * @param {string} path
	 * @param {regExp} regex
	 * @returns {array}
	 */
	luga.router.utils.getParamValues = function(path, regex){
		var values = regex.exec(path);
		/* istanbul ignore else */
		if(values !== null){
			// We want a plain vanilla array, normalize the result object
			values.shift();
			delete values.index;
			delete values.input;
		}
		return values;
	};

}());
{'fraction_non_alphanumeric': 0.20769622833843018, 'fraction_numerical': 0.0015290519877675841, 'mean_word_length': 2.8991554893194236, 'pattern_counts': {'":': 14, '<': 3, '<?xml version=': 0, '>': 3, 'https://': 2, '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': '3482014', 'n_tokens_mistral': 3107, 'n_tokens_neox': 2720, 'n_words': 732}