mirror of
https://github.com/movie-web/providers.git
synced 2025-09-13 13:33:25 +00:00
Merge pull request #105 from capak07/fix227
Updated compare function to check a edge case
This commit is contained in:
@@ -1,11 +1,14 @@
|
||||
import { CommonMedia } from '@/entrypoint/utils/media';
|
||||
|
||||
export function normalizeTitle(title: string): string {
|
||||
return title
|
||||
.trim()
|
||||
.toLowerCase()
|
||||
.replace(/['":]/g, '')
|
||||
.replace(/[^a-zA-Z0-9]+/g, '_');
|
||||
let titleTrimmed = title.trim().toLowerCase();
|
||||
if (titleTrimmed !== 'the movie' && titleTrimmed.endsWith('the movie')) {
|
||||
titleTrimmed = titleTrimmed.replace('the movie', '');
|
||||
}
|
||||
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 {
|
||||
|
Reference in New Issue
Block a user