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

    Function nonempty

    • Reduces a Some value to the values it must hold.

      Converts a flexible input into a non-empty array where the call site expects at least one value, so the expectation is stated once and broken inputs fail at the boundary rather than downstream. The result type guarantees a first element, letting callers read it without a presence check.

      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 readonly [T, T]

      An array holding the given values, guaranteed to hold at least one

      TypeError When values holds no value