1
mirror of https://github.com/xitanggg/open-resume synced 2024-11-03 09:19:21 +01:00

Fix a getTextWithHighestFeatureScore bug introduced at #34 to return empty string

This commit is contained in:
Xitang 2023-08-07 00:33:55 -07:00
parent 4337e968c3
commit b5d3bc441b

View File

@ -70,8 +70,9 @@ export const getTextWithHighestFeatureScore = (
if (returnEmptyStringIfHighestScoreIsNotPositive && highestScore <= 0)
return ["", textScores] as const;
// Note: If textItems is an empty array, textsWithHighestFeatureScore[0] is undefined, so we default it to empty string
const text = !returnConcatenatedStringForTextsWithSameHighestScore
? textsWithHighestFeatureScore[0]
? textsWithHighestFeatureScore[0] ?? ""
: textsWithHighestFeatureScore.map((s) => s.trim()).join(" ");
return [text, textScores] as const;