662
return scoreA > scoreB ? -1 : 1;
663
}
665
>
// 4.) scores are identical: prefer matches in label over non-label matches
666
>
const itemAHasLabelMatches = Array.isArray(itemScoreA.labelMatch) && itemScoreA.labelMatch.length > 0;
667
const itemBHasLabelMatches = Array.isArray(itemScoreB.labelMatch) && itemScoreB.labelMatch.length > 0;
668
if (itemAHasLabelMatches && !itemBHasLabelMatches) {
669
return -1;
670
>
} else if (itemBHasLabelMatches && !itemAHasLabelMatches) {
fuzzyScorer.ts
671
return 1;
672
}