1
0
mirror of https://github.com/gorhill/uBlock.git synced 2024-07-05 11:37:01 +02:00

[mv3] Fine tuning ruleset output

This commit is contained in:
Raymond Hill 2023-12-11 09:29:59 -05:00
parent cc305b84e0
commit acc2950736
No known key found for this signature in database
GPG Key ID: 25E1490B761470C2

View File

@ -297,9 +297,9 @@ function pruneHostnameArray(hostnames) {
/*******************************************************************************
*
* One rule per line for compromise between size and readability. This also
* means that the number of lines in resulting file representative of the
* number of rules in the ruleset.
* For large rulesets, one rule per line for compromise between size and
* readability. This also means that the number of lines in resulting file
* representative of the number of rules in the ruleset.
*
* */
@ -318,9 +318,10 @@ function toJSONRuleset(ruleset) {
}
return v;
};
const indent = ruleset.length > 10 ? undefined : 1;
const out = [];
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`;
}