Index: lib/matcher.js |
=================================================================== |
--- a/lib/matcher.js |
+++ b/lib/matcher.js |
@@ -17,27 +17,26 @@ |
"use strict"; |
/** |
* @fileOverview Matcher class implementing matching addresses against |
* a list of filters. |
*/ |
-const {Filter, WhitelistFilter} = require("./filterClasses"); |
+import {Filter, WhitelistFilter} from "./filterClasses"; |
/** |
* Blacklist/whitelist filter matching |
* @constructor |
*/ |
-function Matcher() |
+export function Matcher() |
{ |
this.clear(); |
} |
-exports.Matcher = Matcher; |
Matcher.prototype = { |
/** |
* Lookup table for filters by their associated keyword |
* @type {Map.<string,Filter>} |
*/ |
filterByKeyword: null, |
@@ -239,23 +238,22 @@ |
}; |
/** |
* Combines a matcher for blocking and exception rules, automatically sorts |
* rules into two Matcher instances. |
* @constructor |
* @augments Matcher |
*/ |
-function CombinedMatcher() |
+export function CombinedMatcher() |
{ |
this.blacklist = new Matcher(); |
this.whitelist = new Matcher(); |
this.resultCache = Object.create(null); |
} |
-exports.CombinedMatcher = CombinedMatcher; |
/** |
* Maximal number of matching cache entries to be kept |
* @type {number} |
*/ |
CombinedMatcher.maxCacheEntries = 1000; |
CombinedMatcher.prototype = |
@@ -442,9 +440,9 @@ |
return result; |
} |
}; |
/** |
* Shared CombinedMatcher instance that should usually be used. |
* @type {CombinedMatcher} |
*/ |
-exports.defaultMatcher = new CombinedMatcher(); |
+export let defaultMatcher = new CombinedMatcher(); |