ts-iterable-functions
    Preparing search index...

    Function unionConst

    • Produces the union of two iterables, preserving the first occurrence of each distinct element.

      Curried version of _union.

      Type Parameters

      • T

        Element type produced by the source and additional iterables.

      Parameters

      • seq: Iterable<T>

        Secondary iterable whose unique elements extend the union.

      • OptionalsetFactory: SetFactory<T>

        Optional factory creating the set instance used for uniqueness tracking.

      Returns (src: Iterable) => Iterable

      A deferred iterable yielding distinct elements from src followed by unseen items from seq.

      Error Rethrows any error thrown by setFactory or during enumeration of the inputs.

      const left = [1, 2, 3];
      const right = [3, 4, 5];
      const merged = [..._union(left, right)];
      console.log(merged); // [1, 2, 3, 4, 5]

      or using the curried version:

      const merged = [
      ...pipeInto(
      [1, 2, 3],
      union([3, 4, 5])
      ),
      ];
      console.log(merged); // [1, 2, 3, 4, 5]