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

    Function optional

    • Reduces a Some value to the single value it may hold.

      Converts a flexible input into a plain optional value where the call site accepts one value at most, so the expectation is stated once and broken inputs fail at the boundary rather than downstream.

      Type Parameters

      • T

        The type of the contained values

      Parameters

      • values: Some<T>

        The value to reduce: undefined, a single T, or a collection of T drawn from exactly once, so single-pass iterators are safe to pass

      Returns T | undefined

      The single value held by values, or undefined if it holds none

      TypeError When values holds more than one value