ts-iterable-functions
    Preparing search index...

    Function _fullOuterJoin

    • Performs a full outer join by pairing elements from both iterables for every distinct key.

      Type Parameters

      • T

        Element type produced by the left source iterable.

      • TRight

        Element type produced by the right source iterable.

      • TKey

        Key type generated by the key selector functions.

      • TOut

        Result type emitted by the selector.

      Parameters

      • src: Iterable<T>

        Left source iterable evaluated for outer join matches.

      • rightSeq: Iterable<TRight>

        Right source iterable evaluated for outer join matches.

      • leftKeySelector: IndexedSelector<T, TKey>

        Selector producing a key for each left element.

      • rightKeySelector: IndexedSelector<TRight, TKey>

        Selector producing a key for each right element.

      • selector: (o: T | undefined, v: TRight | undefined, k: TKey) => TOut

        Projection receiving optional left and right elements plus the shared key.

      • OptionalmapFactory: MapFactory<TKey>

        Optional factory used to create the internal map for key lookups.

      Returns Iterable<TOut>

      A deferred iterable yielding the result of selector for each matched key combination.

      const result = [..._fullOuterJoin(
      [
      { id: 1, label: "L1" },
      { id: 2, label: "L2" }
      ],
      [
      { id: 2, label: "R2" },
      { id: 3, label: "R3" }
      ],
      (left) => left.id,
      (right) => right.id,
      (left, right, id) => ({
      id,
      left: left?.label,
      right: right?.label
      })
      )];
      console.log(result);
      // [
      // { id: 1, left: "L1", right: undefined },
      // { id: 2, left: "L2", right: "R2" },
      // { id: 3, left: undefined, right: "R3" }
      // ]

      or using the curried version:

      const result = pipeInto(
      [
      { id: 1, name: "Alice" }
      ],
      fullOuterJoin(
      [
      { id: 1, city: "Paris" },
      { id: 2, city: "Rome" }
      ],
      (left) => left.id,
      (right) => right.id,
      (left, right, id) => ({
      id,
      name: left?.name ?? null,
      city: right?.city ?? null
      })
      )
      );
      console.log([...result]);
      // [
      // { id: 1, name: "Alice", city: "Paris" },
      // { id: 2, name: null, city: "Rome" }
      // ]