Updated compare function to check a edge case

This commit is contained in:
capak07
2024-03-04 18:16:33 -04:00
parent 89ae529dd1
commit 8a3155999b

View File

@@ -1,11 +1,14 @@
import { CommonMedia } from '@/entrypoint/utils/media';
export function normalizeTitle(title: string): string {
return title
.trim()
let titleTrimmed = title.trim();
if (titleTrimmed !== "The Movie" && titleTrimmed.endsWith("The Movie")) {
titleTrimmed = titleTrimmed.replace("The Movie", "");
}
return titleTrimmed
.toLowerCase()
.replace(/['":]/g, '')
.replace(/[^a-zA-Z0-9]+/g, '_');
.replace(/['":]/g, "")
.replace(/[^a-zA-Z0-9]+/g, "_");
}
export function compareTitle(a: string, b: string): boolean {