Avoid prototype modifications in lib/filterClasses.js
Background
In lib/filterClasses.js
we write code like this:
class ActiveFilter
{
constructor(text, domains)
{
super(text);
if (domains)
this.domainSource = domains.toLowerCase();
}
}
ActiveFilter.prototype.domainSource = null;
The reason for not setting the domainSource
property in the constructor is to keep the memory usage low. Unfortunately this has a negative effect on performance. Moreover, the memory usage reduction is too small to justify such code.
We could write it like this instead:
class ActiveFilter
{
constructor(text, domains)
{
super(text);
this.domainSource = domains ? domains.toLowerCase() : null;
}
}
This would ensure that all properties are set in exactly the same order so the object has the same shape.
What to change
Avoid any prototype modifications in lib/filterClasses.js