-
Notifications
You must be signed in to change notification settings - Fork 0
leftJoin
Eugene Lazutkin edited this page Jun 25, 2026
·
1 revision
Left outer join of sorted streams: the first named input is required, every other input is optional and null-filled when it has no row at the current key. A thin wrapper over join — same inputs, options, and semantics, only the optionality differs.
import leftJoin from 'stream-sorting/sorted/left-join.js';
for await (const {emp, mgr} of leftJoin({
emp: {input: employees, key: e => e.id}, // required — every employee emits
mgr: {input: managers, key: m => m.empId} // optional — null when none
})) {
// every employee, with their manager record or `mgr === null`
}The first map entry is the anchor (kept for every key it has); the rest are null-filled when absent. All of join's inputs, options (compareKey / lessKey / combine / maxGroupSize), and the named-bag combine apply unchanged. For arbitrary requiredness across more than two inputs, set optional per input on join directly.