• Collects all raw (non-normalized) title strings from manga data. Uses cache for consistency. Includes English, Romaji, Native titles and all synonyms.

    Parameters

    Returns string[]

    Array of all title strings in their original form.

    export function collectMangaTitles(manga: AniListManga): string[] {
    const titles: string[] = [];
    const cacheWarmer = getCacheWarmer();

    const addRawTitle = (rawTitle: string | null | undefined) => {
    if (!rawTitle) return;
    // Cache the raw title for consistency
    cacheWarmer.getNormalizedTitle(
    rawTitle,
    "collectMangaTitles",
    () => rawTitle,
    );
    titles.push(rawTitle);
    };

    addRawTitle(manga.title.english);
    addRawTitle(manga.title.romaji);
    addRawTitle(manga.title.native);

    if (manga.synonyms && Array.isArray(manga.synonyms)) {
    for (const synonym of manga.synonyms) {
    addRawTitle(synonym);
    }
    }

    return titles;
    }