@adguard/agtree
Version:
Tool set for working with adblock filter lists
47 lines (45 loc) • 1.35 kB
JavaScript
/*
* AGTree v3.2.1 (build date: Wed, 28 May 2025 13:36:39 GMT)
* (c) 2025 Adguard Software Ltd.
* Released under the MIT license
* https://github.com/AdguardTeam/tsurlfilter/tree/master/packages/agtree#readme
*/
/**
* Property map for binary serialization. This helps to reduce the size of the serialized data,
* as it allows us to use a single byte to represent a property.
*
* ! IMPORTANT: If you change values here, please update the {@link BINARY_SCHEMA_VERSION}!
*
* @note Only 256 values can be represented this way.
*/
const CosmeticRuleMarshallingMap = {
Exception: 2,
Separator: 3,
Modifiers: 4,
Domains: 5,
Start: 7,
End: 8,
};
/**
* Value map for binary serialization. This helps to reduce the size of the serialized data,
* as it allows us to use a single byte to represent frequently used values.
*
* ! IMPORTANT: If you change values here, please update the {@link BINARY_SCHEMA_VERSION}!
*
* @note Only 256 values can be represented this way.
*/
const COSMETIC_RULE_SEPARATOR_SERIALIZATION_MAP = new Map([
['##', 0],
['#@#', 1],
['#?#', 2],
['#@?#', 3],
['#$#', 4],
['#$?#', 5],
['#@$#', 6],
['#@$?#', 7],
['#%#', 8],
['#@%#', 9],
['$$', 10],
['$@$', 11],
]);
export { COSMETIC_RULE_SEPARATOR_SERIALIZATION_MAP, CosmeticRuleMarshallingMap };