feat: improve title searching algorithm for aniwatch
This commit is contained in:
@@ -22,14 +22,14 @@ type Title = {
|
||||
|
||||
export const findBestMatchingTitle = (
|
||||
title: Partial<Title>,
|
||||
titles: Partial<Title>[],
|
||||
titlesToSearch: Partial<Title>[],
|
||||
): string | null => {
|
||||
const { english, userPreferred } = title;
|
||||
|
||||
const userPreferredBestMatch = userPreferred
|
||||
? findBestMatch(
|
||||
userPreferred,
|
||||
titles
|
||||
titlesToSearch
|
||||
.map((title) => title.userPreferred)
|
||||
.filter((title) => title !== undefined),
|
||||
)
|
||||
@@ -37,7 +37,7 @@ export const findBestMatchingTitle = (
|
||||
const englishBestMatch = english
|
||||
? findBestMatch(
|
||||
english,
|
||||
titles
|
||||
titlesToSearch
|
||||
.map((title) => title.english)
|
||||
.filter((title) => title !== undefined),
|
||||
)
|
||||
|
||||
Reference in New Issue
Block a user