ghostery/adblocker

Filter#toString supports alternative modifier names

chrmod opened this issue · 0 comments

chrmod commented

We should provide a option for the NetworkFilter#toString to accept a mapping function that will allow consumers to choose alternative names for the modifiers.

One usecase is export filters compatible with ABP engine which currently prefers longer forms over the short ones. For example ABP accepts $third-party but not $1p.

A mapping function is more adequate than a dictionary as it provides opportunity to handle unknown modifiers - the user can log or throw errors.