pdf-lite - v1.0.1
    Preparing search index...

    Function assertIfDefined

    • Conditionally asserts a condition only when a value is defined. Does nothing if the value is undefined or null.

      Parameters

      • value: unknown

        The value to check for definedness.

      • condition: unknown

        The condition to assert if value is defined.

      • Optionalmessage: string

        Optional error message to throw if the assertion fails.

      Returns asserts condition

      Error if value is defined and condition is falsy.

      assertIfDefined(user, user?.age >= 18, 'User must be an adult')