mirror of
https://github.com/SukkaW/Surge.git
synced 2025-12-17 11:50:27 +08:00
Fix dedupe
This commit is contained in:
parent
2c2d9c119e
commit
1f8786c229
@ -5,6 +5,8 @@ const Piscina = require('piscina');
|
|||||||
const fullsetDomainStartsWithADot = Piscina.workerData
|
const fullsetDomainStartsWithADot = Piscina.workerData
|
||||||
const totalLen = fullsetDomainStartsWithADot.length;
|
const totalLen = fullsetDomainStartsWithADot.length;
|
||||||
|
|
||||||
|
const DOT = '.';
|
||||||
|
|
||||||
// const log = isCI ? () => { } : console.log.bind(console);
|
// const log = isCI ? () => { } : console.log.bind(console);
|
||||||
/**
|
/**
|
||||||
* @param {{ chunk: string[] }} param0
|
* @param {{ chunk: string[] }} param0
|
||||||
@ -25,17 +27,23 @@ module.exports = ({ chunk }) => {
|
|||||||
const domainFromFullSetLen = domainStartsWithADotAndFromFullSet.length;
|
const domainFromFullSetLen = domainStartsWithADotAndFromFullSet.length;
|
||||||
|
|
||||||
if (domainFromInputLen < domainFromFullSetLen) {
|
if (domainFromInputLen < domainFromFullSetLen) {
|
||||||
if (domainFromInputLen + 1 === domainFromFullSetLen) {
|
if (domainFromInputLen + 1 !== domainFromFullSetLen) {
|
||||||
// !domainFromInput.starsWith('.') && `.${domainFromInput}` === domainFromFullSet
|
|
||||||
if (domainFromInputChunk.charCodeAt(0) !== 46 && domainFromInputChunk.endsWith(domainStartsWithADotAndFromFullSet)) {
|
|
||||||
outputToBeRemoved[i] = 1;
|
|
||||||
// log(domainFromInputChunk, domainStartsWithADotAndFromFullSet)
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
} else {
|
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
} else if (domainFromInputLen > domainFromFullSetLen && domainFromInputChunk.endsWith(domainStartsWithADotAndFromFullSet)) {
|
|
||||||
|
// !domainFromInput.starsWith('.') && `.${domainFromInput}` === domainFromFullSet
|
||||||
|
if (
|
||||||
|
domainFromInputChunk[0] !== DOT
|
||||||
|
&& domainStartsWithADotAndFromFullSet.endsWith(domainFromInputChunk)
|
||||||
|
) {
|
||||||
|
outputToBeRemoved[i] = 1;
|
||||||
|
// log(domainFromInputChunk, domainStartsWithADotAndFromFullSet)
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
} else if (
|
||||||
|
domainFromInputLen > domainFromFullSetLen
|
||||||
|
&& domainFromInputChunk.endsWith(domainStartsWithADotAndFromFullSet)
|
||||||
|
) {
|
||||||
outputToBeRemoved[i] = 1;
|
outputToBeRemoved[i] = 1;
|
||||||
// log(domainFromInputChunk, domainStartsWithADotAndFromFullSet)
|
// log(domainFromInputChunk, domainStartsWithADotAndFromFullSet)
|
||||||
break;
|
break;
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user