gulp/helpers/navMap-helpers.js
function getTitleMap(startMap, userSearchTerm, isRecursive) {

		var returnValue = false;
		var found = false;
		var isRecursive = defaultTo(isRecursive, true);

		function iterator(map, searchTerm){
			for(var i = 0; i < map.length; i++) {
				var item = map[i];
				//removes any html in the strings before searching for a match
				var itemTitle = stripTags(item.title).toLowerCase();
				var providedTitle = stripTags(searchTerm).toLowerCase();

				//also converts strings to lowercase so they aren't case sensitive
				if (itemTitle === providedTitle){
					//if the provided title matches the current item title, set the return value to current item
					returnValue = item;
					found = true;
					break;

				} else if ('subnav' in item && isRecursive){
					iterator(item.subnav, searchTerm);

					if (found){
						break;
					}
				}
			}
		}

		iterator(startMap.subnav, userSearchTerm);

		if (returnValue === false){
			//shouldn't do this unless the function fails
			console.log('\n"'+ userSearchTerm +'" title could not be found in navMap.json');
		}

		return returnValue;
	}
function getTitleMap(startMap, userSearchTerm, isRecursive) {

		var returnValue = false;
		var found = false;
		var isRecursive = defaultTo(isRecursive, true);

		function iterator(map, searchTerm){
			for(var i = 0; i < map.length; i++) {
				var item = map[i];
				//removes any html in the strings before searching for a match
				var itemTitle = stripTags(item.title).toLowerCase();
				var providedTitle = stripTags(searchTerm).toLowerCase();

				//also converts strings to lowercase so they aren't case sensitive
				if (itemTitle === providedTitle){
					//if the provided title matches the current item title, set the return value to current item
					returnValue = item;
					found = true;
					break;

				} else if ('subnav' in item && isRecursive){
					iterator(item.subnav, searchTerm);

					if (found){
						break;
					}
				}
			}
		}

		iterator(startMap.subnav, userSearchTerm);

		if (returnValue === false){
			//shouldn't do this unless the function fails
			console.log('\n"'+ userSearchTerm +'" title could not be found in navMap.json');
		}

		return returnValue;
	}
function getTitleMap ( startMap , userSearchTerm , isRecursive ) { var returnValue = false ; var found = false ; var isRecursive = defaultTo ( isRecursive , true ) ; function iterator ( map , searchTerm ) { for ( var i = 0 ; i < map . length ; i ++ ) { var item = map [ i ] ; //removes any html in the strings before searching for a match var itemTitle = stripTags ( item . title ) . toLowerCase ( ) ; var providedTitle = stripTags ( searchTerm ) . toLowerCase ( ) ; //also converts strings to lowercase so they aren't case sensitive if ( itemTitle === providedTitle ) { //if the provided title matches the current item title, set the return value to current item returnValue = item ; found = true ; break ; } else if ( 'subnav' in item && isRecursive ) { iterator ( item . subnav , searchTerm ) ; if ( found ) { break ; } } } } iterator ( startMap . subnav , userSearchTerm ) ; if ( returnValue === false ) { //shouldn't do this unless the function fails console . log ( '\n"' + userSearchTerm + '" title could not be found in navMap.json' ) ; } return returnValue ; }
function that retrieves a map from the navMap variable based on the title attribute function not to be used in regular code
function that retrieves a map from the navMap variable based on the title attribute function not to be used in regular code