adios-engine
ABP rules => Safari content blocker rules
Last updated 5 years ago by armandgrillet .
GPL-3.0 · Repository · Bugs · Original npm · Tarball · package.json
$ cnpm install adios-engine 
SYNC missed versions from official npm registry.

Adios Engine

A small library to transform standard AdBlock Plus rules like EasyList into rules working in Safari.

Installation

npm install adios-engine --save

Usage

var parser = require('adios-engine');
var rule = 'savevideo.me,sddt.com,~search.yahoo.com,yahoo.com,youthedesigner.com,yuku.com##.ads';
var rules = ['@@|http://example.com', 'http://example.com/banner/foo/bar/img?param'];
var wrongRule = '|http://*.com^*|*$script,third-party,domain=lύ.com';

for (var rule of parser.parseRule(rule)) {
	console.log(rule); // The original rule created two parsed rules, parseRule() always returns an array even if the output is only one parsed rule.
}

for (var rule of parser.parseRules(rules)) {
	console.log(rule); // Will print all the parsed rules from the original rules array, can be used to parse an entire list like EasyList.
}

for (var rule of parser.parseRule(wrongRule)) {
	console.log(rule); // Nothing will be printed because the array returned is empty, the original rule contains characters that are not ASCII compliant.
}

Documentation

Only two functions:

parseRule(rule): takes a String as an argument and returns an array containing the parsed rules. If the rule given cannot be parsed the method returns an empty array.

parseRules(rules): takes a String array as an argument and returns the same thing as parseRule().

Tests

npm test

Current Tags

  • 1.0.2                                ...           latest (5 years ago)

3 Versions

  • 1.0.2                                ...           5 years ago
  • 1.0.1                                ...           5 years ago
  • 1.0.0                                ...           5 years ago
Maintainers (1)
Downloads
Today 0
This Week 0
This Month 0
Last Day 0
Last Week 0
Last Month 3
Dependencies (0)
None
Dev Dependencies (3)
Dependents (4)

Copyright 2014 - 2016 © taobao.org |