class BaseFormatter

Base class for output formatters. Extend this class to create custom output formatters.

Constructors

new
BaseFormatter(options?: FormatterOptions)

Creates a new formatter

Properties

protected
readonly
options: FormatterOptions

Formatter options

Methods

protected
extractHostname(rule: string): string | null

Extracts hostname from an adblock rule

abstract
format(rules: string[]): FormatterResult

Formats rules to the target format

protected
generateHeader(commentPrefix: string): string[]

Generates a header comment

Usage

import { BaseFormatter } from ".";