index.js
function make_pram_getter(tokens) {
	return function (results) {
		// Get only the capturing tokens
		var capture_tokens = remove_raw(tokens);
		var res = {};

		// If the regex didn't actually match, just return an empty object
		if (!results) return res;

		// Remove the first item and iterate through the capture groups
		results.slice(1).forEach(function (capture, index) {
			// Retreive the token description for the capture group
			var token = capture_tokens[index];
			var param = capture;
			// If the token doesn't have a name, continue to next group
			if (!token.name) return;

			// If the token is `multi`, split the capture along `/`, remove empty items
			if (token.type === "multi") {
				param = capture.split("/");
				if (!last(param))
					param = remove_last(param);
				// Otherwise, remove any trailing `/`
			} else if (last(capture) === "/")
				param = remove_last(capture);
			// Set the param on the result object
			res[token.name] = param;
		});
		return res;
	}
}
function make_pram_getter(tokens) {
	return function (results) {
		// Get only the capturing tokens
		var capture_tokens = remove_raw(tokens);
		var res = {};

		// If the regex didn't actually match, just return an empty object
		if (!results) return res;

		// Remove the first item and iterate through the capture groups
		results.slice(1).forEach(function (capture, index) {
			// Retreive the token description for the capture group
			var token = capture_tokens[index];
			var param = capture;
			// If the token doesn't have a name, continue to next group
			if (!token.name) return;

			// If the token is `multi`, split the capture along `/`, remove empty items
			if (token.type === "multi") {
				param = capture.split("/");
				if (!last(param))
					param = remove_last(param);
				// Otherwise, remove any trailing `/`
			} else if (last(capture) === "/")
				param = remove_last(capture);
			// Set the param on the result object
			res[token.name] = param;
		});
		return res;
	}
}
function make_pram_getter ( tokens ) { return function ( results ) { // Get only the capturing tokens var capture_tokens = remove_raw ( tokens ) ; var res = { } ; // If the regex didn't actually match, just return an empty object if ( ! results ) return res ; // Remove the first item and iterate through the capture groups results . slice ( 1 ) . forEach ( function ( capture , index ) { // Retreive the token description for the capture group var token = capture_tokens [ index ] ; var param = capture ; // If the token doesn't have a name, continue to next group if ( ! token . name ) return ; // If the token is `multi`, split the capture along `/`, remove empty items if ( token . type === "multi" ) { param = capture . split ( "/" ) ; if ( ! last ( param ) ) param = remove_last ( param ) ; // Otherwise, remove any trailing `/` } else if ( last ( capture ) === "/" ) param = remove_last ( capture ) ; // Set the param on the result object res [ token . name ] = param ; } ) ; return res ; } }
Generates the function for getting the params object from the regex results
Generates the function for getting the params object from the regex results