mirror of https://github.com/gorhill/uBlock.git
[mv3] Fine tuning ruleset output
This commit is contained in:
parent
cc305b84e0
commit
acc2950736
|
@ -297,9 +297,9 @@ function pruneHostnameArray(hostnames) {
|
||||||
|
|
||||||
/*******************************************************************************
|
/*******************************************************************************
|
||||||
*
|
*
|
||||||
* One rule per line for compromise between size and readability. This also
|
* For large rulesets, one rule per line for compromise between size and
|
||||||
* means that the number of lines in resulting file representative of the
|
* readability. This also means that the number of lines in resulting file
|
||||||
* number of rules in the ruleset.
|
* representative of the number of rules in the ruleset.
|
||||||
*
|
*
|
||||||
* */
|
* */
|
||||||
|
|
||||||
|
@ -318,9 +318,10 @@ function toJSONRuleset(ruleset) {
|
||||||
}
|
}
|
||||||
return v;
|
return v;
|
||||||
};
|
};
|
||||||
|
const indent = ruleset.length > 10 ? undefined : 1;
|
||||||
const out = [];
|
const out = [];
|
||||||
for ( const rule of ruleset ) {
|
for ( const rule of ruleset ) {
|
||||||
out.push(JSON.stringify(rule, replacer));
|
out.push(JSON.stringify(rule, replacer, indent));
|
||||||
}
|
}
|
||||||
return `[\n${out.join(',\n')}\n]\n`;
|
return `[\n${out.join(',\n')}\n]\n`;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue