Sharing title filter function between manticore update module and sync tool, fixing sync tool title filter word boundaries.

This commit is contained in:
DebaucheryLibrarian
2024-07-05 02:55:02 +02:00
parent f11a009395
commit 36a51f0491
3 changed files with 13 additions and 2 deletions

View File

@@ -0,0 +1,9 @@
function filterTitle(title, keys) {
if (!title) {
return title;
}
return keys.reduce((accTitle, tag) => accTitle.replace(new RegExp(`\\b${tag.replace(/[^\w\s]+/g, '')}\\b`, 'gi'), ''), title).trim().replace(/\s{2,}/, ' ');
}
module.exports = filterTitle;