Function: join()
join<
L,R,Out>(left,right,config):Stream<Out[]>
Defined in: packages/core/src/graph/transforms.ts:47
Relational join of two array streams.
const joined = join(enriched, classified, { on: (e, c) => e.id === c.id, emit: (e, c) => ({ ...e, category: c.category }), }); // Stream<{ id, ..., category }[]>
Cross-joins the two input arrays, applies on as the match predicate,
and emits one row of output per matching (l, r) pair. l / r in
the callbacks are typed by the input streams — hover either in an IDE
and the exact row shape appears. Output element type is inferred from
emit.
Why arrays: a single-row stream of L joined with a single-row stream
of R is equivalent to merge({left, right}).pipe(...) and wouldn't
earn the name "join". The useful case is "take an array of enriched
rows and an array of classified rows, pair them by id" — that's what
this signature supports.
Type Parameters
L
L
R
R
Out
Out
Parameters
left
Stream<readonly L[]>
right
Stream<readonly R[]>
config
emit
(l, r) => Out
on
(l, r) => boolean
Returns
Stream<Out[]>