areTitlesSimilarEnough = (title1, title2, similarity) => {
let matchCount = 0
let shortestText = normalizeTitle(title1.length < title2.length ? title1 : title2)
let longestText = normalizeTitle(title1.length < title2.length ? title2 : title1)
let lastIndex = 0
for (const c of shortestText) {
let newIndex = longestText.substring(lastIndex).indexOf(c)
if (newIndex > -1) {
matchCount += 1
lastIndex = newIndex
}
}
let similiarityPercent = matchCount / shortestText.length
console.log(similiarityPercent)
return similiarityPercent >= similarity
}