getFilterMiddleware<T> function
Conditionally runs middleware or stops the chain
Example:
getFilterMiddleware(
(context) => context.authorized,
middlewareForAuthorized
);
Implementation
Middleware<T> getFilterMiddleware<T>(
condition,
Middleware<T> filterMiddleware,
) {
branchMiddlewareCondition<T>(condition);
return getBranchMiddleware(condition, filterMiddleware, stopMiddleware);
}