mirror of
https://github.com/sussy-code/providers.git
synced 2026-04-21 00:22:07 +00:00
Updated compare function to check a edge case
This commit is contained in:
parent
89ae529dd1
commit
8a3155999b
1 changed files with 7 additions and 4 deletions
|
|
@ -1,11 +1,14 @@
|
||||||
import { CommonMedia } from '@/entrypoint/utils/media';
|
import { CommonMedia } from '@/entrypoint/utils/media';
|
||||||
|
|
||||||
export function normalizeTitle(title: string): string {
|
export function normalizeTitle(title: string): string {
|
||||||
return title
|
let titleTrimmed = title.trim();
|
||||||
.trim()
|
if (titleTrimmed !== "The Movie" && titleTrimmed.endsWith("The Movie")) {
|
||||||
|
titleTrimmed = titleTrimmed.replace("The Movie", "");
|
||||||
|
}
|
||||||
|
return titleTrimmed
|
||||||
.toLowerCase()
|
.toLowerCase()
|
||||||
.replace(/['":]/g, '')
|
.replace(/['":]/g, "")
|
||||||
.replace(/[^a-zA-Z0-9]+/g, '_');
|
.replace(/[^a-zA-Z0-9]+/g, "_");
|
||||||
}
|
}
|
||||||
|
|
||||||
export function compareTitle(a: string, b: string): boolean {
|
export function compareTitle(a: string, b: string): boolean {
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue