New Case Study:See how Anthropic automated 95% of dependency reviews with Socket.Learn More
Socket
Sign inDemoInstall
Socket

@brigand/abp-filter-parser

Package Overview
Dependencies
Maintainers
2
Versions
3
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@brigand/abp-filter-parser

For a faster more precise version of this library, see its [C++ gyp rewrite](https://github.com/bbondy/abp-filter-parser-cpp).

  • 0.3.2
  • latest
  • Source
  • npm
  • Socket score

Version published
Weekly downloads
9
increased by125%
Maintainers
2
Weekly downloads
 
Created
Source

abp-filter-parser

For a faster more precise version of this library, see its C++ gyp rewrite.

JavaScript Adblock Plus filter parser for lists like EasyList

Build Status

Parses filter rules as per:

Usage

Babel / ES6:

import * as ABPFilterParser from 'abp-filter-parser.js';

Node:

let ABPFilterParser = require('abp-filter-parser');

Primary API:

let ABPFilterParser = require('abp-filter-parser');
var fs = require('fs');

let easyListTxt = fs.readFileSync('./test/data/easylist.txt', 'utf-8');
let parsedFilterData = {};
let urlToCheck = 'http://static.tumblr.com/dhqhfum/WgAn39721/cfh_header_banner_v2.jpg';

// This is the site who's URLs are being checked, not the domain of the URL being checked.
let currentPageDomain = 'slashdot.org';

ABPFilterParser.parse(easyListTxt, parsedFilterData);
// ABPFilterParser.parse(someOtherListOfFilters, parsedFilterData);

if (ABPFilterParser.matches(parsedFilterData, urlToCheck, {
      domain: currentPageDomain,
      elementTypeMaskMap: ABPFilterParser.elementTypes.SCRIPT,
    })) {
  console.log('You should block this URL!');
} else {
  console.log('You should NOT block this URL!');
}

Secondary APIs

You probably won't need these directly, they are used by the primary API above.

  • parseDomains
  • parseOptions
  • parseHTMLFilter
  • parseFilter
  • matchesFilter

FAQs

Package last updated on 09 Mar 2018

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc