npm.io
1.0.1 • Published 8 years ago

mctrackerlist

Licence
ISC
Version
1.0.1
Deps
0
Size
248 kB
Vulns
0
Weekly
0

McTrackerList

A Tracking Protection List lib for node and the browser

usage

  var McTrackerList = require("mctrackerlist")

  mc = new McTrackerList([
    // blacklist domain
    '-d www.google.com',
    // whitelist domain
    '+d www.elephantmouse.com',
    // blacklist substring
    '- chickenwing.cup',
    // whitelist substring
    '+ bee/hut'
  ])

  mc.match('www.google.com') // true
  mc.match('www.google.com/bee/hut') // false
  mc.match('www.sidewalk.com/chickenwing.cup') // true
  mc.match('www.elephantmouse.com/chickenwing.cup') // false

  // update rules
  mc.compile([
    // whitelist domain
    '+d www.google.com',
    // blacklist domain
    '-d www.elephantmouse.com',
    // blacklist substring
    '- chickenwing.cup',
    // whitelist substring
    '+ bee/hut'
  ])

run tests

make test