mirror of
https://github.com/sussy-code/providers.git
synced 2026-04-21 08:31:57 +00:00
Merge pull request #105 from capak07/fix227
Updated compare function to check a edge case
This commit is contained in:
commit
6bc765caed
1 changed files with 8 additions and 5 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().toLowerCase();
|
||||||
.trim()
|
if (titleTrimmed !== 'the movie' && titleTrimmed.endsWith('the movie')) {
|
||||||
.toLowerCase()
|
titleTrimmed = titleTrimmed.replace('the movie', '');
|
||||||
.replace(/['":]/g, '')
|
}
|
||||||
.replace(/[^a-zA-Z0-9]+/g, '_');
|
if (titleTrimmed !== 'the series' && titleTrimmed.endsWith('the series')) {
|
||||||
|
titleTrimmed = titleTrimmed.replace('the series', '');
|
||||||
|
}
|
||||||
|
return titleTrimmed.replace(/['":]/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