feat: implement duplicate title normalized filter

This commit is contained in:
Tiberiu Ichim 2026-02-22 16:46:14 +02:00
parent aa85106681
commit ead215e777
13 changed files with 276 additions and 1 deletions

View file

@ -191,6 +191,18 @@ module.exports.getTitleIgnorePrefix = (title) => {
return getTitleParts(title)[0]
}
/**
* Get normalized title to use for grouping duplicates
* Removes non-alphabetic characters (numbers, punctuation, spaces)
* @param {string} title
* @returns {string}
*/
module.exports.getNormalizedTitle = (title) => {
if (!title) return ''
const sortTitle = getTitleParts(title)[0] || title
return sortTitle.toLowerCase().replace(/[^\p{L}]/gu, '')
}
/**
* Put sorting prefix at the end of title
* @example "The Good Book" => "Good Book, The"