aboutsummaryrefslogtreecommitdiff
path: root/src/shared/blacklists.js
blob: 21e3e14ddef6c9f90c30c32f5e5a2971ee51e177 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
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 };