@reactivex/ix-esnext-esm
Version:
The Interactive Extensions for JavaScript
1 lines • 3.06 kB
Source Map (JSON)
{"version":3,"sources":["iterable/operators/except.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAE,MAAM,cAAc,CAAC;AACzC,OAAO,EAAE,YAAY,EAAE,MAAM,yBAAyB,CAAC;AACvD,OAAO,EAAE,QAAQ,IAAI,eAAe,EAAE,MAAM,qBAAqB,CAAC;AAGlE,MAAM,OAAO,cAAwB,SAAQ,SAAkB;IAK7D,YACE,KAAwB,EACxB,MAAyB,EACzB,QAA6C;QAE7C,KAAK,EAAE,CAAC;QACR,IAAI,CAAC,MAAM,GAAG,KAAK,CAAC;QACpB,IAAI,CAAC,OAAO,GAAG,MAAM,CAAC;QACtB,IAAI,CAAC,SAAS,GAAG,QAAQ,CAAC;IAC5B,CAAC;IAED,CAAC,CAAC,MAAM,CAAC,QAAQ,CAAC;QAChB,MAAM,GAAG,GAAG,EAAe,CAAC;QAC5B,KAAK,MAAM,UAAU,IAAI,IAAI,CAAC,OAAO,EAAE;YACrC,GAAG,CAAC,IAAI,CAAC,UAAU,CAAC,CAAC;SACtB;QAED,KAAK,MAAM,SAAS,IAAI,IAAI,CAAC,MAAM,EAAE;YACnC,IAAI,YAAY,CAAC,GAAG,EAAE,SAAS,EAAE,IAAI,CAAC,SAAS,CAAC,KAAK,CAAC,CAAC,EAAE;gBACvD,GAAG,CAAC,IAAI,CAAC,SAAS,CAAC,CAAC;gBACpB,MAAM,SAAS,CAAC;aACjB;SACF;IACH,CAAC;CACF;AAED;;;;;;;;;;GAUG;AACH,MAAM,UAAU,MAAM,CACpB,MAAyB,EACzB,WAAgD,eAAe;IAE/D,OAAO,SAAS,sBAAsB,CAAC,KAAwB;QAC7D,OAAO,IAAI,cAAc,CAAU,KAAK,EAAE,MAAM,EAAE,QAAQ,CAAC,CAAC;IAC9D,CAAC,CAAC;AACJ,CAAC","file":"except.js","sourcesContent":["import { IterableX } from '../iterablex';\nimport { arrayIndexOf } from '../../util/arrayindexof';\nimport { comparer as defaultComparer } from '../../util/comparer';\nimport { MonoTypeOperatorFunction } from '../../interfaces';\n\nexport class ExceptIterable<TSource> extends IterableX<TSource> {\n private _first: Iterable<TSource>;\n private _second: Iterable<TSource>;\n private _comparer: (x: TSource, y: TSource) => boolean;\n\n constructor(\n first: Iterable<TSource>,\n second: Iterable<TSource>,\n comparer: (x: TSource, y: TSource) => boolean\n ) {\n super();\n this._first = first;\n this._second = second;\n this._comparer = comparer;\n }\n\n *[Symbol.iterator]() {\n const map = [] as TSource[];\n for (const secondItem of this._second) {\n map.push(secondItem);\n }\n\n for (const firstItem of this._first) {\n if (arrayIndexOf(map, firstItem, this._comparer) === -1) {\n map.push(firstItem);\n yield firstItem;\n }\n }\n }\n}\n\n/**\n * Produces the set difference of two iterable sequences by using the specified equality comparer to compare values.\n *\n * @export\n * @template TSource The type of the elements of the input sequences.\n * @param {Iterable<TSource>} second An iterable sequence whose elements that also occur in the\n * operator sequence will cause those elements to be removed from the returned sequence.\n * @param {((x: TSource, y: TSource) => boolean} [comparer=defaultComparer] An equality comparer to compare values\n * @returns {MonoTypeOperatorFunction<TSource>} An operator that returns a sequence that contains the set\n * difference of the elements of two sequences.\n */\nexport function except<TSource>(\n second: Iterable<TSource>,\n comparer: (x: TSource, y: TSource) => boolean = defaultComparer\n): MonoTypeOperatorFunction<TSource> {\n return function exceptOperatorFunction(first: Iterable<TSource>): IterableX<TSource> {\n return new ExceptIterable<TSource>(first, second, comparer);\n };\n}\n"]}