Function optionalOfNullable

  • Creates an optional that resolves to a value returned by getInput if that value is not null or undefined, or resolves to empty otherwise.

    Type Parameters

    • T

      Non-nullable input value type

    Parameters

    • getInput: () => undefined | null | T

      Function that produces a value or null or undefined

    Returns Optional<T>

    An optional containing the value from getInput if it's not null or undefined, otherwise an empty optional.