Front end of the Slack clone application.

1
  1. {"version":3,"file":"find.js","sourceRoot":"","sources":["../../src/operators/find.ts"],"names":[],"mappings":";;;;;;AAEA,2BAA2B,eAAe,CAAC,CAAA;AAW3C;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAgCG;AACH,cAAwB,SAAsE,EACtE,OAAa;IACnC,EAAE,CAAC,CAAC,OAAO,SAAS,KAAK,UAAU,CAAC,CAAC,CAAC;QACpC,MAAM,IAAI,SAAS,CAAC,6BAA6B,CAAC,CAAC;IACrD,CAAC;IACD,MAAM,CAAC,UAAC,MAAqB,IAAK,OAAA,MAAM,CAAC,IAAI,CAAC,IAAI,iBAAiB,CAAC,SAAS,EAAE,MAAM,EAAE,KAAK,EAAE,OAAO,CAAC,CAAC,EAArE,CAAqE,CAAC;AAC1G,CAAC;AANe,YAAI,OAMnB,CAAA;AAED;IACE,2BAAoB,SAAsE,EACtE,MAAqB,EACrB,UAAmB,EACnB,OAAa;QAHb,cAAS,GAAT,SAAS,CAA6D;QACtE,WAAM,GAAN,MAAM,CAAe;QACrB,eAAU,GAAV,UAAU,CAAS;QACnB,YAAO,GAAP,OAAO,CAAM;IACjC,CAAC;IAED,gCAAI,GAAJ,UAAK,QAAuB,EAAE,MAAW;QACvC,MAAM,CAAC,MAAM,CAAC,SAAS,CAAC,IAAI,mBAAmB,CAAC,QAAQ,EAAE,IAAI,CAAC,SAAS,EAAE,IAAI,CAAC,MAAM,EAAE,IAAI,CAAC,UAAU,EAAE,IAAI,CAAC,OAAO,CAAC,CAAC,CAAC;IACzH,CAAC;IACH,wBAAC;AAAD,CAAC,AAVD,IAUC;AAVY,yBAAiB,oBAU7B,CAAA;AAED;;;;GAIG;AACH;IAA4C,uCAAa;IAGvD,6BAAY,WAA0B,EAClB,SAAsE,EACtE,MAAqB,EACrB,UAAmB,EACnB,OAAa;QAC/B,kBAAM,WAAW,CAAC,CAAC;QAJD,cAAS,GAAT,SAAS,CAA6D;QACtE,WAAM,GAAN,MAAM,CAAe;QACrB,eAAU,GAAV,UAAU,CAAS;QACnB,YAAO,GAAP,OAAO,CAAM;QANzB,UAAK,GAAW,CAAC,CAAC;IAQ1B,CAAC;IAEO,4CAAc,GAAtB,UAAuB,KAAU;QAC/B,IAAM,WAAW,GAAG,IAAI,CAAC,WAAW,CAAC;QAErC,WAAW,CAAC,IAAI,CAAC,KAAK,CAAC,CAAC;QACxB,WAAW,CAAC,QAAQ,EAAE,CAAC;IACzB,CAAC;IAES,mCAAK,GAAf,UAAgB,KAAQ;QACtB,IAAA,SAAmC,EAA3B,wBAAS,EAAE,oBAAO,CAAU;QACpC,IAAM,KAAK,GAAG,IAAI,CAAC,KAAK,EAAE,CAAC;QAC3B,IAAI,CAAC;YACH,IAAM,MAAM,GAAG,SAAS,CAAC,IAAI,CAAC,OAAO,IAAI,IAAI,EAAE,KAAK,EAAE,KAAK,EAAE,IAAI,CAAC,MAAM,CAAC,CAAC;YAC1E,EAAE,CAAC,CAAC,MAAM,CAAC,CAAC,CAAC;gBACX,IAAI,CAAC,cAAc,CAAC,IAAI,CAAC,UAAU,GAAG,KAAK,GAAG,KAAK,CAAC,CAAC;YACvD,CAAC;QACH,CAAE;QAAA,KAAK,CAAC,CAAC,GAAG,CAAC,CAAC,CAAC;YACb,IAAI,CAAC,WAAW,CAAC,KAAK,CAAC,GAAG,CAAC,CAAC;QAC9B,CAAC;IACH,CAAC;IAES,uCAAS,GAAnB;QACE,IAAI,CAAC,cAAc,CAAC,IAAI,CAAC,UAAU,GAAG,CAAC,CAAC,GAAG,SAAS,CAAC,CAAC;IACxD,CAAC;IACH,0BAAC;AAAD,CAAC,AAlCD,CAA4C,uBAAU,GAkCrD;AAlCY,2BAAmB,sBAkC/B,CAAA","sourcesContent":["import { Observable } from '../Observable';\nimport { Operator } from '../Operator';\nimport { Subscriber } from '../Subscriber';\nimport { OperatorFunction, MonoTypeOperatorFunction } from '../interfaces';\n\nexport function find<T, S extends T>(predicate: (value: T, index: number, source: Observable<T>) => value is S,\n thisArg?: any): OperatorFunction<T, S>;\nexport function find<T, S extends T>(predicate: (value: T, index: number) => value is S,\n thisArg?: any): OperatorFunction<T, S>;\nexport function find<T>(predicate: (value: T, index: number, source: Observable<T>) => boolean,\n thisArg?: any): MonoTypeOperatorFunction<T>;\nexport function find<T>(predicate: (value: T, index: number) => boolean,\n thisArg?: any): MonoTypeOperatorFunction<T>;\n/**\n * Emits only the first value emitted by the source Observable that meets some\n * condition.\n *\n * <span class=\"informal\">Finds the first value that passes some test and emits\n * that.</span>\n *\n * <img src=\"./img/find.png\" width=\"100%\">\n *\n * `find` searches for the first item in the source Observable that matches the\n * specified condition embodied by the `predicate`, and returns the first\n * occurrence in the source. Unlike {@link first}, the `predicate` is required\n * in `find`, and does not emit an error if a valid value is not found.\n *\n * @example <caption>Find and emit the first click that happens on a DIV element</caption>\n * var clicks = Rx.Observable.fromEvent(document, 'click');\n * var result = clicks.find(ev => ev.target.tagName === 'DIV');\n * result.subscribe(x => console.log(x));\n *\n * @see {@link filter}\n * @see {@link first}\n * @see {@link findIndex}\n * @see {@link take}\n *\n * @param {function(value: T, index: number, source: Observable<T>): boolean} predicate\n * A function called with each item to test for condition matching.\n * @param {any} [thisArg] An optional argument to determine the value of `this`\n * in the `predicate` function.\n * @return {Observable<T>} An Observable of the first item that matches the\n * condition.\n * @method find\n * @owner Observable\n */\nexport function find<T>(predicate: (value: T, index: number, source: Observable<T>) => boolean,\n thisArg?: any): MonoTypeOperatorFunction<T> {\n if (typeof predicate !== 'function') {\n throw new TypeError('predicate is not a function');\n }\n return (source: Observable<T>) => source.lift(new FindValueOperator(predicate, source, false, thisArg));\n}\n\nexport class FindValueOperator<T> implements Operator<T, T> {\n constructor(private predicate: (value: T, index: number, source: Observable<T>) => boolean,\n private source: Observable<T>,\n private yieldIndex: boolean,\n private thisArg?: any) {\n }\n\n call(observer: Subscriber<T>, source: any): any {\n return source.subscribe(new FindValueSubscriber(observer, this.predicate, this.source, this.yieldIndex, this.thisArg));\n }\n}\n\n/**\n * We need this JSDoc comment for affecting ESDoc.\n * @ignore\n * @extends {Ignored}\n */\nexport class FindValueSubscriber<T> extends Subscriber<T> {\n private index: number = 0;\n\n constructor(destination: Subscriber<T>,\n private predicate: (value: T, index: number, source: Observable<T>) => boolean,\n private source: Observable<T>,\n private yieldIndex: boolean,\n private thisArg?: any) {\n super(destination);\n }\n\n private notifyComplete(value: any): void {\n const destination = this.destination;\n\n destination.next(value);\n destination.complete();\n }\n\n protected _next(value: T): void {\n const { predicate, thisArg } = this;\n const index = this.index++;\n try {\n const result = predicate.call(thisArg || this, value, index, this.source);\n if (result) {\n this.notifyComplete(this.yieldIndex ? index : value);\n }\n } catch (err) {\n this.destination.error(err);\n }\n }\n\n protected _complete(): void {\n this.notifyComplete(this.yieldIndex ? -1 : undefined);\n }\n}\n"]}