src/graph/matching/match-set.js
function findInsertLocation(matches, score) {
	const idx = binarySearch(matches, 0, matches.length, score);

	if(idx < 0) {
		// If the score was not found
		return - idx - 1;
	}

	/*
		* Something with the same score was found, make sure this item is
		* added after all previous items with the same score.
		*/
	for(let i=idx+1; i<matches.length; i++) {
		if(matches[i].score < score) return i;
	}

	return matches.length;
}
function findInsertLocation(matches, score) {
	const idx = binarySearch(matches, 0, matches.length, score);

	if(idx < 0) {
		// If the score was not found
		return - idx - 1;
	}

	/*
		* Something with the same score was found, make sure this item is
		* added after all previous items with the same score.
		*/
	for(let i=idx+1; i<matches.length; i++) {
		if(matches[i].score < score) return i;
	}

	return matches.length;
}
function findInsertLocation ( matches , score ) { const idx = binarySearch ( matches , 0 , matches . length , score ) ; if ( idx < 0 ) { // If the score was not found return - idx - 1 ; } /*
		* Something with the same score was found, make sure this item is
		* added after all previous items with the same score.
		*/ for ( let i = idx + 1 ; i < matches . length ; i ++ ) { if ( matches [ i ] . score < score ) return i ; } return matches . length ; }
Find the insert location of an matches with the given score.

@param {number} score
Find the insert location of an matches with the given score .