Element type produced by the left source iterable.
Element type produced by the right source iterable.
Key type generated by the key selector functions.
Result type emitted by the selector.
Left source iterable evaluated to build the left-side lookup.
Right source iterable evaluated alongside the left lookup.
Selector producing a key for each left element.
Selector producing a key for each right element.
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.
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"] }
// ]
Performs a full outer join that supplies grouped left and right sequences for each distinct key.