Sharing title filter function between manticore update module and sync tool, fixing sync tool title filter word boundaries.
This commit is contained in:
9
src/utils/filter-title.js
Normal file
9
src/utils/filter-title.js
Normal 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;
|
||||
Reference in New Issue
Block a user