Private StaticfiltersA static map to hold all filters. The key is the hook name, and the value is an Map of FilterEntry objects.
Private StaticpipelineA map that holds the pipeline of filters to be applied. The key is the hook name, and the value is the compiled function.
StaticaddAdds a filter to the specified hook.
The name of the hook
The id of the filter
The filter function
Optionalopt: FilterOptions = {}Additional options for the filter
StaticapplyApplies all active filters for a given hook to the input string(s).
The name of the hook
The input string(s) to be filtered
StaticapplyApplies all active filters for a given hook to the input string(s) asynchronously. Each filter function may return a Promise or a plain string; all are awaited in order.
The name of the hook
The input string(s) to be filtered
StaticclearClears all filters or filters for a specific hook. If no hook is provided, clear all filters
Optionalhook: FilterHooksOptional name of the hook to clear filters for
StaticclearClears the entire filter pipeline cache. This forces recompilation of all pipelines on next application.
Private StaticgetRetrieves the compiled filter function for a given hook. If the function is not cached, it compiles it from the active filters.
The name of the hook
StatichasChecks if a filter exists for a given hook and id.
The name of the hook
The id of the filter
StaticlistLists all filters for a given hook.
The name of the hook
If true, only list active filters
StaticpausePauses a filter by its hook and id.
The name of the hook
The id of the filter
StaticremoveRemoves a filter by its hook and id.
The name of the hook
The id of the filter
StaticresumeResumes a filter by its hook and id.
The name of the hook
The id of the filter
The Filter class provides a way to manage and apply filters to strings based on hooks.