packages/nitro-app/app/lib/view.js
function getViewCombinations(action) {
	const pathes = [action];
	const positions = [];
	let i;
	let j;

	for (i = 0; i < action.length; i++) {
		if (action[i] === '-') {
			positions.push(i);
		}
	}

	const len = positions.length;
	const combinations = [];

	for (i = 1; i < (1 << len); i++) {
		const c = [];
		for (j = 0; j < len; j++) {
			if (i & (1 << j)) {
				c.push(positions[j]);
			}
		}
		combinations.push(c);
	}

	combinations.forEach((combination) => {
		let combinationPath = action;
		combination.forEach((pos) => {
			combinationPath = replaceAt(combinationPath, pos, '/');
		});
		pathes.push(combinationPath);
	});
	return pathes;
}
function getViewCombinations(action) {
	const pathes = [action];
	const positions = [];
	let i;
	let j;

	for (i = 0; i < action.length; i++) {
		if (action[i] === '-') {
			positions.push(i);
		}
	}

	const len = positions.length;
	const combinations = [];

	for (i = 1; i < (1 << len); i++) {
		const c = [];
		for (j = 0; j < len; j++) {
			if (i & (1 << j)) {
				c.push(positions[j]);
			}
		}
		combinations.push(c);
	}

	combinations.forEach((combination) => {
		let combinationPath = action;
		combination.forEach((pos) => {
			combinationPath = replaceAt(combinationPath, pos, '/');
		});
		pathes.push(combinationPath);
	});
	return pathes;
}
function getViewCombinations ( action ) { const pathes = [ action ] ; const positions = [ ] ; let i ; let j ; for ( i = 0 ; i < action . length ; i ++ ) { if ( action [ i ] === '-' ) { positions . push ( i ) ; } } const len = positions . length ; const combinations = [ ] ; for ( i = 1 ; i < ( 1 << len ) ; i ++ ) { const c = [ ] ; for ( j = 0 ; j < len ; j ++ ) { if ( i & ( 1 << j ) ) { c . push ( positions [ j ] ) ; } } combinations . push ( c ) ; } combinations . forEach ( ( combination ) => { let combinationPath = action ; combination . forEach ( ( pos ) => { combinationPath = replaceAt ( combinationPath , pos , '/' ) ; } ) ; pathes . push ( combinationPath ) ; } ) ; return pathes ; }
get possible view paths
@param action The requested route (e.g. content-example)
@returns {Array} array of strings of possible paths to view files (e.g. content-example, content/example)
get possible view paths