@adguard/agtree
Version:
Tool set for working with adblock filter lists
31 lines (28 loc) • 853 B
JavaScript
/*
* AGTree v4.1.1 (build date: Thu, 23 Apr 2026 09:15:37 GMT)
* (c) 2026 Adguard Software Ltd.
* Released under the MIT license
* https://github.com/AdguardTeam/tsurlfilter/tree/master/packages/agtree#readme
*/
import { MODIFIERS_SEPARATOR } from '../../utils/constants.js';
import { BaseGenerator } from '../base-generator.js';
import { ModifierGenerator } from './modifier-generator.js';
/**
* Generator for modifier list nodes.
*/
class ModifierListGenerator extends BaseGenerator {
/**
* Converts a modifier list AST to a string.
*
* @param ast Modifier list AST.
*
* @returns Raw string.
*/
static generate(ast) {
const result = ast.children
.map(ModifierGenerator.generate)
.join(MODIFIERS_SEPARATOR);
return result;
}
}
export { ModifierListGenerator };