Skip to content

withSkip

withSkip(skipFn, handler): MiddlewareHandler

Defined in: src/policies/sdk/helpers.ts:68

Wrap a middleware handler with skip logic.

If skipFn is undefined, returns the original handler unchanged (zero overhead). Otherwise wraps it: when skipFn(c) returns true, calls next() without running the handler.

This implements the PolicyConfig.skip feature that was defined in types but never enforced at runtime.

Optional predicate from PolicyConfig.skip.

(c) => boolean | Promise<boolean> | undefined

MiddlewareHandler

The policy’s middleware handler.

MiddlewareHandler

The original handler or a skip-aware wrapper.