diff options
Diffstat (limited to 'src/shared/blacklists.js')
-rw-r--r-- | src/shared/blacklists.js | 13 |
1 files changed, 13 insertions, 0 deletions
diff --git a/src/shared/blacklists.js b/src/shared/blacklists.js new file mode 100644 index 0000000..19ed3f1 --- /dev/null +++ b/src/shared/blacklists.js @@ -0,0 +1,13 @@ +import * as re from 'shared/utils/re'; + +const includes = (blacklist, url) => { + let u = new URL(url); + return blacklist.some((item) => { + if (!item.includes('/')) { + return re.fromWildcard(item).test(u.hostname); + } + return re.fromWildcard(item).test(u.hostname + u.pathname); + }); +}; + +export { includes }; |