UNPKG

@electric-sql/d2ts

Version:

D2TS is a TypeScript implementation of Differential Dataflow.

24 lines 848 B
import { DifferenceStreamWriter } from '../graph.js'; import { StreamBuilder } from '../d2.js'; import { LinearUnaryOperator } from './base.js'; /** * Operator that negates the multiplicities in the input stream */ export class NegateOperator extends LinearUnaryOperator { inner(collection) { return collection.negate(); } } /** * Negates the multiplicities in the input stream */ export function negate() { return (stream) => { const output = new StreamBuilder(stream.graph, new DifferenceStreamWriter()); const operator = new NegateOperator(stream.graph.getNextOperatorId(), stream.connectReader(), output.writer, stream.graph.frontier()); stream.graph.addOperator(operator); stream.graph.addStream(output.connectReader()); return output; }; } //# sourceMappingURL=negate.js.map