[]previous and next page

any

Passes when at least one guard passes.

Passes when at least one guard passes. Guards run in order; the first to pass ends the check. When none passes, the last refusal is the outcome: its thrown error, or a 403 for a guard that returned false.

Import#

ts
import { any } from "@shadow-js/dusk/server";

Signature#

ts
function any(...guards: readonly Guard[]): Guard

Parameters#

Name Description
guards At least one guard.

Returns#

One guard.

Throws#

  • TypeError when no guard is given.
  • The request signal's reason when cancellation precedes a guard or its awaited result.

Examples#

ts
serverFn({ guard: any(requireAdmin, requireOwner) }, handler);