ts-iterable-functions
    Preparing search index...

    Function _fullOuterGroupJoin

    • Performs a full outer join that supplies grouped left and right sequences for each 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 to build the left-side lookup.

      • rightSeq: Iterable<TRight>

        Right source iterable evaluated alongside the left lookup.

      • 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: Iterable<T>, v: Iterable<TRight>, k: TKey) => TOut

        Projection that receives the grouped left items, grouped right items, and their key.

      • OptionalmapFactory: MapFactory<TKey>

        Optional factory used to create the internal map for grouping.

      Returns Iterable<TOut>

      A deferred iterable yielding one result per distinct key across both sequences.

      const result = [..._fullOuterGroupJoin(
      [
      { id: 1, label: "L1" },
      { id: 2, label: "L2" }
      ],
      [
      { id: 2, label: "R2" },
      { id: 3, label: "R3" }
      ],
      (left) => left.id,
      (right) => right.id,
      (leftItems, rightItems, id) => ({
      id,
      left: [...leftItems].map((x) => x.label),
      right: [...rightItems].map((x) => x.label)
      })
      )];
      console.log(result);
      // [
      // { id: 1, left: ["L1"], right: [] },
      // { id: 2, left: ["L2"], right: ["R2"] },
      // { id: 3, left: [], right: ["R3"] }
      // ]

      or using the curried version:

      const result = pipeInto(
      [
      { id: 1, label: "A" }
      ],
      fullOuterGroupJoin(
      [
      { id: 1, label: "B" },
      { id: 2, label: "C" }
      ],
      (left) => left.id,
      (right) => right.id,
      (leftItems, rightItems, id) => ({
      id,
      left: [...leftItems].map((item) => item.label),
      right: [...rightItems].map((item) => item.label)
      })
      )
      );
      console.log([...result]);
      // [
      // { id: 1, left: ["A"], right: ["B"] },
      // { id: 2, left: [], right: ["C"] }
      // ]