UNPKG

@electric-sql/d2mini

Version:

D2Mini is a minimal implementation of Differential Dataflow for performing in-memory incremental view maintenance.

17 lines 730 B
import { map } from './map.js'; import { innerJoin } from './join.js'; import { consolidate } from './consolidate.js'; /** * Filters the elements of a keyed stream, by keys of another stream. * This allows you to build pipelies where you have multiple outputs that are related, * such as a streams of issues and comments for a project. * * @param other - The other stream to filter by, which must have the same key type as the input stream */ export function filterBy(other) { return (stream) => { const otherKeys = other.pipe(map(([key, _]) => [key, null])); return stream.pipe(innerJoin(otherKeys), map(([key, [value, _]]) => [key, value]), consolidate()); }; } //# sourceMappingURL=filterBy.js.map