Options
All
  • Public
  • Public/Protected
  • All
Menu

Module utils/Predicates

Functions

failIf

  • failIf(predicate: boolean): void
  • Throws a GuardFailed error if predicate is true.

    Purpose:

    • This helps to write predicate functions as a linear chain of individual tests.

    Parameters

    • predicate: boolean

      Predicate

    Returns void

falseIfGuardFailed

  • falseIfGuardFailed(err: Error): false
  • Consumes an GuardFailed error and returns false, but otherwise rethrows.

    Purpose:

    • This helps to write predicate functions as a linear chain of individual tests.
    throws

    Rethrows the error if it is not a GuardFailed error.

    Parameters

    Returns false

    false if error is a GuardFailed error.

okIf

  • okIf(predicate: boolean): predicate
  • Does nothing if the predicate is true. Otherwise throws GuardFailed error.

    Purpose:

    • This helps to write predicate functions as a linear chain of individual tests.

    Parameters

    • predicate: boolean

    Returns predicate

verifyErrorIsGuardFailure

  • verifyErrorIsGuardFailure(err: Error): void
  • Parameters

    Returns void