b75bc3a60e2eb3f5fe93a682bc4fee289e2bbea40b78c1d284d674d1cab339e1.json 1.2 KB

1
  1. {"ast":null,"code":"import { Subscriber } from '../Subscriber';\nimport { empty } from '../observable/empty';\nexport function repeat(count = -1) {\n return source => {\n if (count === 0) {\n return empty();\n } else if (count < 0) {\n return source.lift(new RepeatOperator(-1, source));\n } else {\n return source.lift(new RepeatOperator(count - 1, source));\n }\n };\n}\nclass RepeatOperator {\n constructor(count, source) {\n this.count = count;\n this.source = source;\n }\n call(subscriber, source) {\n return source.subscribe(new RepeatSubscriber(subscriber, this.count, this.source));\n }\n}\nclass RepeatSubscriber extends Subscriber {\n constructor(destination, count, source) {\n super(destination);\n this.count = count;\n this.source = source;\n }\n complete() {\n if (!this.isStopped) {\n const {\n source,\n count\n } = this;\n if (count === 0) {\n return super.complete();\n } else if (count > -1) {\n this.count = count - 1;\n }\n source.subscribe(this._unsubscribeAndRecycle());\n }\n }\n}\n//# sourceMappingURL=repeat.js.map","map":null,"metadata":{},"sourceType":"module","externalDependencies":[]}