Skip to Content
nyx logonyx guide

Filters

Reading time:1 min read

Filters are objects or callbacks that can restrict the execution of a given component.

They receive all the information about the execution (context, arguments, metadata), and return a boolean indicating whether the execution should proceed (true) or strictly stop (false).

Wrapping/Merging Filters

The framework has some utility filters that wrap or merge others, allowing you to create complex filters by combining simpler ones.

These wrappers work "synchronously", meaning that it'll wait for each filter, in the order they were passed, before checking whether to proceed to the next.

AndFilter

Combines multiple filters and only allows the execution if all filters return true.

new AndFilter(filter1, filter2, filter3)

OrFilter

Combines multiple filters and allows the execution if at least one filter returns true.

new OrFilter(filter1, filter2)

NotFilter

Inverts the result of a single filter, allowing the execution if the filter returns false.

new NotFilter(filter)

On this page