Housekeeping

This commit is contained in:
SukkaW
2023-05-26 23:20:51 +08:00
parent ec97a26d1d
commit 72f8d06bd2
3 changed files with 215 additions and 177 deletions

View File

@@ -23,24 +23,21 @@ module.exports.dedupe = ({ chunk }) => {
const domainFromFullSetLen = domainFromFullSet.length;
// !domainFromInput.starsWith('.') && `.${domainFromInput}` === domainFromFullSet
if (domainFromInput.charCodeAt(0) !== 46) {
if (domainFromInputLen + 1 === domainFromFullSetLen) {
if (domainFromInput[0] !== '.' && domainFromInputLen + 1 === domainFromFullSetLen) {
let shouldBeRemoved = true;
let shouldBeRemoved = true;
for (let k = 0; k < domainFromInputLen; k++) {
if (domainFromFullSet[k + 1] !== domainFromInput[k]) {
shouldBeRemoved = false;
break;
}
}
if (shouldBeRemoved) {
outputToBeRemoved[i] = 1;
log(domainFromInput, domainFromFullSet)
for (let k = 0; k < domainFromInputLen; k++) {
if (domainFromFullSet[k + 1] !== domainFromInput[k]) {
shouldBeRemoved = false;
break;
}
}
if (shouldBeRemoved) {
outputToBeRemoved[i] = 1;
log(domainFromInput, domainFromFullSet)
break;
}
}
if (domainFromInputLen > domainFromFullSetLen) {
// domainFromInput is now startsWith a "."