UNPKG

@adguard/agtree

Version:
31 lines (28 loc) 994 B
/* * AGTree v3.2.4 (build date: Fri, 17 Oct 2025 14:48:54 GMT) * (c) 2025 Adguard Software Ltd. * Released under the MIT license * https://github.com/AdguardTeam/tsurlfilter/tree/master/packages/agtree#readme */ import { AdblockSyntax } from '../utils/adblockers.js'; /** * 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. */ let syntaxSerializationMap; const getSyntaxSerializationMap = () => { if (!syntaxSerializationMap) { syntaxSerializationMap = new Map([ [AdblockSyntax.Common, 0], [AdblockSyntax.Abp, 1], [AdblockSyntax.Adg, 2], [AdblockSyntax.Ubo, 3], ]); } return syntaxSerializationMap; }; export { getSyntaxSerializationMap };