UNPKG

@adguard/agtree

Version:
46 lines (45 loc) 1.41 kB
/** * @file Cosmetic rule separator finder and categorizer */ import { CosmeticRuleSeparator } from '../nodes/index.js'; export interface CosmeticRuleSeparatorFinderResult { /** * Separator type */ separator: CosmeticRuleSeparator; /** * Separator start position */ start: number; /** * Separator end position */ end: number; } /** * Utility class for cosmetic rule separators. */ export declare class CosmeticRuleSeparatorUtils { /** * Checks whether the specified separator is an exception. * * @param separator Separator to check * @returns `true` if the separator is an exception, `false` otherwise */ static isException(separator: CosmeticRuleSeparator): boolean; /** * Checks whether the specified separator is marks an Extended CSS cosmetic rule. * * @param separator Separator to check * @returns `true` if the separator is marks an Extended CSS cosmetic rule, `false` otherwise */ static isExtendedCssMarker(separator: CosmeticRuleSeparator): boolean; /** * Looks for the cosmetic rule separator in the rule. This is a simplified version that * masks the recursive function. * * @param rule Raw rule * @returns Separator result or null if no separator was found */ static find(rule: string): CosmeticRuleSeparatorFinderResult | null; }