Skip to main content

Function: isConditionValid()

isConditionValid(condition, context?): boolean

Defined in: packages/polizy/src/conditions.ts:66

Returns whether a tuple's condition currently grants access.

  • No condition → always valid.
  • Time window: validSince <= now < validUntil (lower inclusive, upper exclusive). Values are coerced; unparseable dates are treated as invalid.
  • Attribute predicates: every predicate must pass against context. A missing context value or a type mismatch fails the predicate.

Evaluation never throws — a malformed condition fails closed (denies) rather than aborting the surrounding authorization check.

Parameters

condition

Condition | undefined

context?

Record<string, unknown>

Returns

boolean