createFunctionPrecondition(Defined in: packages/http-framework/src/lib/decorators/utils.ts:72 Utility to make a method decorator with lighter syntax and inferred types.precondition,fallback?):MethodDecorator
Parameters
precondition
(…args) => boolean | Promise<boolean>
The predicate to run before the decorated method. It receives the same arguments as the method
and is called with the same this.
fallback?
(…args) => unknown
The fallback to run when the precondition is not met. Defaults to a no-op returning undefined.
Returns
MethodDecorator
The decorator.
Remarks
The decorated method is replaced by anasync one, so it always returns a Promise, even when both the
precondition and the original method are synchronous.