Function makeOptional

  • Take a function that requires a value of T and return a version that takes Optional<T>

    NB: If an empty Optional is passed to the new function, a NoSuchElementException will be thrown

    Type Parameters

    • T

    Parameters

    • f: ((o) => unknown)
        • (o): unknown
        • Parameters

          Returns unknown

    Returns ((v) => unknown)

      • (v): unknown
      • Parameters

        Returns unknown