aboutsummaryrefslogblamecommitdiff
path: root/src/shared/blacklists.js
blob: 19ed3f171ebbcb4d6c436f0511b7373e8cae9fbe (plain) (tree)
1
2
3
4
5
6
7
8
9
10

                                      
                       




                                                               
  
                    
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 };