Type of elements within the outer sequence.
Type of elements within the inner sequence.
Type of key produced by the key selectors.
Type of element returned by resultSelector.
The outer sequence.
Sequence whose elements are joined with the outer sequence.
Selector that extracts the join key from each outer element.
Selector that extracts the join key from each inner element.
Projection that combines an outer element with a matching inner element. When no match exists, null is supplied as the outer value.
OptionalkeyComparator: EqualityComparator<TKey, TKey>Optional equality comparator used to match keys. Defaults to the library's standard equality comparison when omitted.
A sequence generated by applying resultSelector to each matching pair (and unmatched inner elements).
The outer sequence is fully enumerated to build an in-memory lookup before inner elements are processed. The inner sequence is then enumerated lazily and its original ordering is preserved. This is a right outer join.
const categories = [
{ id: 1, name: 'Fruit' },
{ id: 2, name: 'Vegetable' },
];
const products = [
{ name: 'Apple', categoryId: 1 },
{ name: 'Banana', categoryId: 1 },
{ name: 'Unknown', categoryId: 3 },
];
const joined = rightJoin(
categories,
products,
c => c.id,
p => p.categoryId,
(c, p) => ({ category: c?.name ?? null, product: p.name })
).toArray();
console.log(joined);
// [
// { category: 'Fruit', product: 'Apple' },
// { category: 'Fruit', product: 'Banana' },
// { category: null, product: 'Unknown' }
// ]
Produces a projection from the sequence and a second sequence by matching elements that share an identical join key. Inner elements with no match are included once with
nullas the outer value.