The manga match result to evaluate.
Advanced filters including confidence bounds.
True if confidence is outside the allowed range.
export function failsConfidenceFilter(
match: MangaMatchResult,
filters: AdvancedMatchFilters,
): boolean {
const selectedEntry = match.selectedMatch
? match.anilistMatches?.find((m) => m.manga?.id === match.selectedMatch?.id)
: match.anilistMatches?.[0];
const matchConfidence = selectedEntry?.confidence;
if (matchConfidence == null) {
return false;
}
return (
matchConfidence < filters.confidence.min ||
matchConfidence > filters.confidence.max
);
}
Returns whether a match violates the configured confidence range.