lib/sampler/sampler.js
function pathToQuery(pathname) {
	if (typeof pathname !== 'string') {
		throw new Error('Invalid path: ' + pathname);
	}

	var path = pathname.split('/');

	// Remove the useless '' (zeroth) element and the 'sampler' (first) element.

	var samplerPos = path.indexOf('sampler');
	if (samplerPos !== -1) {
		path = path.slice(samplerPos + 1);
	}

	// If the request had a trailing '/', remove the resulting empty final element in the path.
	if (path[path.length - 1] === '') {
		path.pop();
	}

	return path;
}
function pathToQuery(pathname) {
	if (typeof pathname !== 'string') {
		throw new Error('Invalid path: ' + pathname);
	}

	var path = pathname.split('/');

	// Remove the useless '' (zeroth) element and the 'sampler' (first) element.

	var samplerPos = path.indexOf('sampler');
	if (samplerPos !== -1) {
		path = path.slice(samplerPos + 1);
	}

	// If the request had a trailing '/', remove the resulting empty final element in the path.
	if (path[path.length - 1] === '') {
		path.pop();
	}

	return path;
}
function pathToQuery ( pathname ) { if ( typeof pathname !== 'string' ) { throw new Error ( 'Invalid path: ' + pathname ) ; } var path = pathname . split ( '/' ) ; // Remove the useless '' (zeroth) element and the 'sampler' (first) element. var samplerPos = path . indexOf ( 'sampler' ) ; if ( samplerPos !== - 1 ) { path = path . slice ( samplerPos + 1 ) ; } // If the request had a trailing '/', remove the resulting empty final element in the path. if ( path [ path . length - 1 ] === '' ) { path . pop ( ) ; } return path ; }
Process a url's path into a path array.

@param  {string}   pathname The path from a URL string.
@return {string[]} An array with elements that are sub-paths of increasing depth to index.
Process a url s path into a path array .