1 line
No EOL
5.5 KiB
JSON
1 line
No EOL
5.5 KiB
JSON
{"ast":null,"code":"import { Subscriber } from '../Subscriber';\nimport { EmptyError } from '../util/EmptyError';\nexport function single(predicate) {\n return source => source.lift(new SingleOperator(predicate, source));\n}\nclass SingleOperator {\n constructor(predicate, source) {\n this.predicate = predicate;\n this.source = source;\n }\n call(subscriber, source) {\n return source.subscribe(new SingleSubscriber(subscriber, this.predicate, this.source));\n }\n}\nclass SingleSubscriber extends Subscriber {\n constructor(destination, predicate, source) {\n super(destination);\n this.predicate = predicate;\n this.source = source;\n this.seenValue = false;\n this.index = 0;\n }\n applySingleValue(value) {\n if (this.seenValue) {\n this.destination.error('Sequence contains more than one element');\n } else {\n this.seenValue = true;\n this.singleValue = value;\n }\n }\n _next(value) {\n const index = this.index++;\n if (this.predicate) {\n this.tryNext(value, index);\n } else {\n this.applySingleValue(value);\n }\n }\n tryNext(value, index) {\n try {\n if (this.predicate(value, index, this.source)) {\n this.applySingleValue(value);\n }\n } catch (err) {\n this.destination.error(err);\n }\n }\n _complete() {\n const destination = this.destination;\n if (this.index > 0) {\n destination.next(this.seenValue ? this.singleValue : undefined);\n destination.complete();\n } else {\n destination.error(new EmptyError());\n }\n }\n}","map":{"version":3,"names":["Subscriber","EmptyError","single","predicate","source","lift","SingleOperator","constructor","call","subscriber","subscribe","SingleSubscriber","destination","seenValue","index","applySingleValue","value","error","singleValue","_next","tryNext","err","_complete","next","undefined","complete"],"sources":["/home/arctichawk1/Desktop/Projects/Public/Kargi-Sitesi/node_modules/rxjs/_esm2015/internal/operators/single.js"],"sourcesContent":["import { Subscriber } from '../Subscriber';\nimport { EmptyError } from '../util/EmptyError';\nexport function single(predicate) {\n return (source) => source.lift(new SingleOperator(predicate, source));\n}\nclass SingleOperator {\n constructor(predicate, source) {\n this.predicate = predicate;\n this.source = source;\n }\n call(subscriber, source) {\n return source.subscribe(new SingleSubscriber(subscriber, this.predicate, this.source));\n }\n}\nclass SingleSubscriber extends Subscriber {\n constructor(destination, predicate, source) {\n super(destination);\n this.predicate = predicate;\n this.source = source;\n this.seenValue = false;\n this.index = 0;\n }\n applySingleValue(value) {\n if (this.seenValue) {\n this.destination.error('Sequence contains more than one element');\n }\n else {\n this.seenValue = true;\n this.singleValue = value;\n }\n }\n _next(value) {\n const index = this.index++;\n if (this.predicate) {\n this.tryNext(value, index);\n }\n else {\n this.applySingleValue(value);\n }\n }\n tryNext(value, index) {\n try {\n if (this.predicate(value, index, this.source)) {\n this.applySingleValue(value);\n }\n }\n catch (err) {\n this.destination.error(err);\n }\n }\n _complete() {\n const destination = this.destination;\n if (this.index > 0) {\n destination.next(this.seenValue ? this.singleValue : undefined);\n destination.complete();\n }\n else {\n destination.error(new EmptyError);\n }\n }\n}\n"],"mappings":"AAAA,SAASA,UAAU,QAAQ,eAAe;AAC1C,SAASC,UAAU,QAAQ,oBAAoB;AAC/C,OAAO,SAASC,MAAMA,CAACC,SAAS,EAAE;EAC9B,OAAQC,MAAM,IAAKA,MAAM,CAACC,IAAI,CAAC,IAAIC,cAAc,CAACH,SAAS,EAAEC,MAAM,CAAC,CAAC;AACzE;AACA,MAAME,cAAc,CAAC;EACjBC,WAAWA,CAACJ,SAAS,EAAEC,MAAM,EAAE;IAC3B,IAAI,CAACD,SAAS,GAAGA,SAAS;IAC1B,IAAI,CAACC,MAAM,GAAGA,MAAM;EACxB;EACAI,IAAIA,CAACC,UAAU,EAAEL,MAAM,EAAE;IACrB,OAAOA,MAAM,CAACM,SAAS,CAAC,IAAIC,gBAAgB,CAACF,UAAU,EAAE,IAAI,CAACN,SAAS,EAAE,IAAI,CAACC,MAAM,CAAC,CAAC;EAC1F;AACJ;AACA,MAAMO,gBAAgB,SAASX,UAAU,CAAC;EACtCO,WAAWA,CAACK,WAAW,EAAET,SAAS,EAAEC,MAAM,EAAE;IACxC,KAAK,CAACQ,WAAW,CAAC;IAClB,IAAI,CAACT,SAAS,GAAGA,SAAS;IAC1B,IAAI,CAACC,MAAM,GAAGA,MAAM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