import { contains } from './contains' export function except(first: Iterable, second: Iterable, compare?: (x: T, y: T) => boolean): Iterable { if (first && second) { compare = compare || ((x, y) => x === y) return [...process(first, second, compare)] } return first } function* process(first: Iterable, second: Iterable, compare: (x: T, y: T) => boolean): Iterable { for (let item of first) { if (contains(second, item, compare)) { continue } yield item } }