UNPKG

@adguard/agtree

Version:
60 lines (57 loc) 2.37 kB
/* * AGTree v3.4.3 (build date: Thu, 11 Dec 2025 13:43:19 GMT) * (c) 2025 Adguard Software Ltd. * Released under the MIT license * https://github.com/AdguardTeam/tsurlfilter/tree/master/packages/agtree#readme */ import { NotImplementedError } from '../../errors/not-implemented-error.js'; /** * @file Base class for converters * * TS doesn't support abstract static methods, so we should use * a workaround and extend this class instead of implementing it */ /* eslint-disable jsdoc/require-returns-check */ /* eslint-disable @typescript-eslint/no-unused-vars */ /** * Basic class for rule converters */ class BaseConverter { /** * Converts some data to AdGuard format * * @param data Data to convert * @returns An object which follows the {@link ConversionResult} interface. Its `result` property contains * the converted node, and its `isConverted` flag indicates whether the original node was converted. * If the node was not converted, the result will contain the original node with the same object reference * @throws If the data is invalid or incompatible */ static convertToAdg(data) { throw new NotImplementedError(); } /** * Converts some data to Adblock Plus format * * @param data Data to convert * @returns An object which follows the {@link ConversionResult} interface. Its `result` property contains * the converted node, and its `isConverted` flag indicates whether the original node was converted. * If the node was not converted, the result will contain the original node with the same object reference * @throws If the data is invalid or incompatible */ static convertToAbp(data) { throw new NotImplementedError(); } /** * Converts some data to uBlock Origin format * * @param data Data to convert * @returns An object which follows the {@link ConversionResult} interface. Its `result` property contains * the converted node, and its `isConverted` flag indicates whether the original node was converted. * If the node was not converted, the result will contain the original node with the same object reference * @throws If the data is invalid or incompatible */ static convertToUbo(data) { throw new NotImplementedError(); } } export { BaseConverter };