lib/codepage.js
function findMinIndexValue(pageNumber, searchFor) {
	var lookupAttr = typeof searchFor === 'string' ? 'name' : 'token';
	var minIndexValue = null
	for (var i = 0; i < this.codePage[pageNumber].values.length; i++) {
		let index = searchFor.indexOf(this.codePage[pageNumber].values[i][lookupAttr])
		if ( index >= 0 &&
			(!minIndexValue || (index < minIndexValue.index))){
			minIndexValue = {index: index, value: this.codePage[pageNumber].values[i] }
		}
	}

	return minIndexValue
}
function findMinIndexValue(pageNumber, searchFor) {
	var lookupAttr = typeof searchFor === 'string' ? 'name' : 'token';
	var minIndexValue = null
	for (var i = 0; i < this.codePage[pageNumber].values.length; i++) {
		let index = searchFor.indexOf(this.codePage[pageNumber].values[i][lookupAttr])
		if ( index >= 0 &&
			(!minIndexValue || (index < minIndexValue.index))){
			minIndexValue = {index: index, value: this.codePage[pageNumber].values[i] }
		}
	}

	return minIndexValue
}
function findMinIndexValue ( pageNumber , searchFor ) { var lookupAttr = typeof searchFor === 'string' ? 'name' : 'token' ; var minIndexValue = null for ( var i = 0 ; i < this . codePage [ pageNumber ] . values . length ; i ++ ) { let index = searchFor . indexOf ( this . codePage [ pageNumber ] . values [ i ] [ lookupAttr ] ) if ( index >= 0 && ( ! minIndexValue || ( index < minIndexValue . index ) ) ) { minIndexValue = { index : index , value : this . codePage [ pageNumber ] . values [ i ] } } } return minIndexValue }
Scans the list of values getting the minimun index of the searchFor element
Scans the list of values getting the minimun index of the searchFor element