Tumortisch-Dist/resources/app/node_modules/rxjs/operators/elementAt.js.map
2021-06-15 16:00:08 +02:00

1 line
4.9 KiB
Plaintext

{"version":3,"file":"elementAt.js","sourceRoot":"","sources":["../../src/operators/elementAt.ts"],"names":[],"mappings":";;;;;;AACA,2BAA2B,eAAe,CAAC,CAAA;AAC3C,wCAAwC,iCAAiC,CAAC,CAAA;AAK1E;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAyCG;AACH,mBAA6B,KAAa,EAAE,YAAgB;IAC1D,MAAM,CAAC,UAAC,MAAqB,IAAK,OAAA,MAAM,CAAC,IAAI,CAAC,IAAI,iBAAiB,CAAC,KAAK,EAAE,YAAY,CAAC,CAAC,EAAvD,CAAuD,CAAC;AAC5F,CAAC;AAFe,iBAAS,YAExB,CAAA;AAED;IAEE,2BAAoB,KAAa,EAAU,YAAgB;QAAvC,UAAK,GAAL,KAAK,CAAQ;QAAU,iBAAY,GAAZ,YAAY,CAAI;QACzD,EAAE,CAAC,CAAC,KAAK,GAAG,CAAC,CAAC,CAAC,CAAC;YACd,MAAM,IAAI,iDAAuB,CAAC;QACpC,CAAC;IACH,CAAC;IAED,gCAAI,GAAJ,UAAK,UAAyB,EAAE,MAAW;QACzC,MAAM,CAAC,MAAM,CAAC,SAAS,CAAC,IAAI,mBAAmB,CAAC,UAAU,EAAE,IAAI,CAAC,KAAK,EAAE,IAAI,CAAC,YAAY,CAAC,CAAC,CAAC;IAC9F,CAAC;IACH,wBAAC;AAAD,CAAC,AAXD,IAWC;AAED;;;;GAIG;AACH;IAAqC,uCAAa;IAEhD,6BAAY,WAA0B,EAAU,KAAa,EAAU,YAAgB;QACrF,kBAAM,WAAW,CAAC,CAAC;QAD2B,UAAK,GAAL,KAAK,CAAQ;QAAU,iBAAY,GAAZ,YAAY,CAAI;IAEvF,CAAC;IAES,mCAAK,GAAf,UAAgB,CAAI;QAClB,EAAE,CAAC,CAAC,IAAI,CAAC,KAAK,EAAE,KAAK,CAAC,CAAC,CAAC,CAAC;YACvB,IAAI,CAAC,WAAW,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC;YACzB,IAAI,CAAC,WAAW,CAAC,QAAQ,EAAE,CAAC;QAC9B,CAAC;IACH,CAAC;IAES,uCAAS,GAAnB;QACE,IAAM,WAAW,GAAG,IAAI,CAAC,WAAW,CAAC;QACrC,EAAE,CAAC,CAAC,IAAI,CAAC,KAAK,IAAI,CAAC,CAAC,CAAC,CAAC;YACpB,EAAE,CAAC,CAAC,OAAO,IAAI,CAAC,YAAY,KAAK,WAAW,CAAC,CAAC,CAAC;gBAC7C,WAAW,CAAC,IAAI,CAAC,IAAI,CAAC,YAAY,CAAC,CAAC;YACtC,CAAC;YAAC,IAAI,CAAC,CAAC;gBACN,WAAW,CAAC,KAAK,CAAC,IAAI,iDAAuB,CAAC,CAAC;YACjD,CAAC;QACH,CAAC;QACD,WAAW,CAAC,QAAQ,EAAE,CAAC;IACzB,CAAC;IACH,0BAAC;AAAD,CAAC,AAxBD,CAAqC,uBAAU,GAwB9C","sourcesContent":["import { Operator } from '../Operator';\nimport { Subscriber } from '../Subscriber';\nimport { ArgumentOutOfRangeError } from '../util/ArgumentOutOfRangeError';\nimport { Observable } from '../Observable';\nimport { TeardownLogic } from '../Subscription';\nimport { MonoTypeOperatorFunction } from '../interfaces';\n\n/**\n * Emits the single value at the specified `index` in a sequence of emissions\n * from the source Observable.\n *\n * <span class=\"informal\">Emits only the i-th value, then completes.</span>\n *\n * <img src=\"./img/elementAt.png\" width=\"100%\">\n *\n * `elementAt` returns an Observable that emits the item at the specified\n * `index` in the source Observable, or a default value if that `index` is out\n * of range and the `default` argument is provided. If the `default` argument is\n * not given and the `index` is out of range, the output Observable will emit an\n * `ArgumentOutOfRangeError` error.\n *\n * @example <caption>Emit only the third click event</caption>\n * var clicks = Rx.Observable.fromEvent(document, 'click');\n * var result = clicks.elementAt(2);\n * result.subscribe(x => console.log(x));\n *\n * // Results in:\n * // click 1 = nothing\n * // click 2 = nothing\n * // click 3 = MouseEvent object logged to console\n *\n * @see {@link first}\n * @see {@link last}\n * @see {@link skip}\n * @see {@link single}\n * @see {@link take}\n *\n * @throws {ArgumentOutOfRangeError} When using `elementAt(i)`, it delivers an\n * ArgumentOutOrRangeError to the Observer's `error` callback if `i < 0` or the\n * Observable has completed before emitting the i-th `next` notification.\n *\n * @param {number} index Is the number `i` for the i-th source emission that has\n * happened since the subscription, starting from the number `0`.\n * @param {T} [defaultValue] The default value returned for missing indices.\n * @return {Observable} An Observable that emits a single item, if it is found.\n * Otherwise, will emit the default value if given. If not, then emits an error.\n * @method elementAt\n * @owner Observable\n */\nexport function elementAt<T>(index: number, defaultValue?: T): MonoTypeOperatorFunction<T> {\n return (source: Observable<T>) => source.lift(new ElementAtOperator(index, defaultValue));\n}\n\nclass ElementAtOperator<T> implements Operator<T, T> {\n\n constructor(private index: number, private defaultValue?: T) {\n if (index < 0) {\n throw new ArgumentOutOfRangeError;\n }\n }\n\n call(subscriber: Subscriber<T>, source: any): TeardownLogic {\n return source.subscribe(new ElementAtSubscriber(subscriber, this.index, this.defaultValue));\n }\n}\n\n/**\n * We need this JSDoc comment for affecting ESDoc.\n * @ignore\n * @extends {Ignored}\n */\nclass ElementAtSubscriber<T> extends Subscriber<T> {\n\n constructor(destination: Subscriber<T>, private index: number, private defaultValue?: T) {\n super(destination);\n }\n\n protected _next(x: T) {\n if (this.index-- === 0) {\n this.destination.next(x);\n this.destination.complete();\n }\n }\n\n protected _complete() {\n const destination = this.destination;\n if (this.index >= 0) {\n if (typeof this.defaultValue !== 'undefined') {\n destination.next(this.defaultValue);\n } else {\n destination.error(new ArgumentOutOfRangeError);\n }\n }\n destination.complete();\n }\n}\n"]}