UNPKG

@reactivex/ix-esnext-esm

Version:

The Interactive Extensions for JavaScript

31 lines (29 loc) 957 B
import { IterableX } from '../iterablex'; import { arrayIndexOf } from '../../util/arrayindexof'; import { comparer as defaultComparer } from '../../util/comparer'; export class ExceptIterable extends IterableX { constructor(first, second, comparer) { super(); this._first = first; this._second = second; this._comparer = comparer; } *[Symbol.iterator]() { const map = []; for (const secondItem of this._second) { map.push(secondItem); } for (const firstItem of this._first) { if (arrayIndexOf(map, firstItem, this._comparer) === -1) { map.push(firstItem); yield firstItem; } } } } export function except(second, comparer = defaultComparer) { return function exceptOperatorFunction(first) { return new ExceptIterable(first, second, comparer); }; } //# sourceMappingURL=except.mjs.map