Rietveld Code Review Tool
Help | Bug tracker | Discussion group | Source code

Unified Diff: abp2blocklist.js

Issue 29426594: Issue 3673 - Merge closely matching rules (Closed) Base URL: https://hg.adblockplus.org/abp2blocklist
Patch Set: Rebase Created July 28, 2017, 1:31 p.m.
Use n/p to move between diff chunks; N/P to move between comments.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | lib/abp2blocklist.js » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: abp2blocklist.js
===================================================================
--- a/abp2blocklist.js
+++ b/abp2blocklist.js
@@ -17,33 +17,34 @@
"use strict";
let readline = require("readline");
let Filter = require("filterClasses").Filter;
let ContentBlockerList = require("./lib/abp2blocklist.js").ContentBlockerList;
var rl = readline.createInterface({input: process.stdin, terminal: false});
-var blockerList = new ContentBlockerList();
+var blockerList = new ContentBlockerList({merge: "all"});
rl.on("line", line =>
{
if (/^\s*[^\[\s]/.test(line))
blockerList.addFilter(Filter.fromText(Filter.normalize(line)));
});
rl.on("close", () =>
{
- let rules = blockerList.generateRules();
-
- // If the rule set is too huge, JSON.stringify throws
- // "RangeError: Invalid string length" on Node.js. As a workaround, print
- // each rule individually.
- console.log("[");
- if (rules.length > 0)
+ blockerList.generateRules().then(rules =>
{
- let stringifyRule = rule => JSON.stringify(rule, null, "\t");
- for (let i = 0; i < rules.length - 1; i++)
- console.log(stringifyRule(rules[i]) + ",");
- console.log(stringifyRule(rules[rules.length - 1]));
- }
- console.log("]");
+ // If the rule set is too huge, JSON.stringify throws
+ // "RangeError: Invalid string length" on Node.js. As a workaround, print
+ // each rule individually.
+ console.log("[");
+ if (rules.length > 0)
+ {
+ let stringifyRule = rule => JSON.stringify(rule, null, "\t");
+ for (let i = 0; i < rules.length - 1; i++)
+ console.log(stringifyRule(rules[i]) + ",");
+ console.log(stringifyRule(rules[rules.length - 1]));
+ }
+ console.log("]");
+ });
});
« no previous file with comments | « no previous file | lib/abp2blocklist.js » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld