class CompressTransformation

Transformation that compresses the final list by removing redundant rules. Also converts /etc/hosts rules to adblock-style rules.

Properties

readonly
name: string

Human-readable name of the transformation

The transformation type identifier

Methods

executeSync(rules: string[]): string[]

Executes the compression transformation synchronously.

private
hasParentDomainRule(
hostname: string,
byHostname: Record<string, boolean>,
): boolean

Checks if any parent domain already has a blocking rule. Uses index-based iteration to avoid creating intermediate arrays.

private
toAdblockRules(ruleText: string): IBlocklistRule[]

Converts a rule to an array of blocklist rules.

Usage

import { CompressTransformation } from ".";