@metreeca/core - v0.10.0
    Preparing search index...

    Function isOptional

    • Checks if a value is Optional.

      Absence is accepted on its own: undefined passes without consulting the guard, while every other value, null included, must satisfy it. Suited to optional fields in isObject templates, where a missing property and a valid one are equally acceptable.

      Type Parameters

      • T

        The type validated by the type guard

      Parameters

      • value: unknown

        The value to check

      • is: Guard<T>

        A type guard function to validate the value if it is not undefined

      Returns value is Optional<T>

      True if the value is undefined or satisfies the type guard; false otherwise