import { Pipe } from "../pipe.js"; import { assertSync, Done, Yield } from "../util/index.js"; export function isDisjointFrom(source: Iterable): Pipe { assertSync(source); return () => { let sourceSet: Set = source instanceof Set ? source : new Set(source); return (result: IteratorResult): Array> => { if (result?.done) { return [Yield(true), result]; } if (sourceSet.has(result.value)) { return [Yield(false), Done()]; } }; } }