1 /** PURE_IMPORTS_START tslib,_Subscriber,_util_ArgumentOutOfRangeError,_observable_empty PURE_IMPORTS_END */
2 import * as tslib_1 from "tslib";
3 import { Subscriber } from '../Subscriber';
4 import { ArgumentOutOfRangeError } from '../util/ArgumentOutOfRangeError';
5 import { empty } from '../observable/empty';
6 export function take(count) {
7 return function (source) {
12 return source.lift(new TakeOperator(count));
16 var TakeOperator = /*@__PURE__*/ (function () {
17 function TakeOperator(total) {
20 throw new ArgumentOutOfRangeError;
23 TakeOperator.prototype.call = function (subscriber, source) {
24 return source.subscribe(new TakeSubscriber(subscriber, this.total));
28 var TakeSubscriber = /*@__PURE__*/ (function (_super) {
29 tslib_1.__extends(TakeSubscriber, _super);
30 function TakeSubscriber(destination, total) {
31 var _this = _super.call(this, destination) || this;
36 TakeSubscriber.prototype._next = function (value) {
37 var total = this.total;
38 var count = ++this.count;
40 this.destination.next(value);
41 if (count === total) {
42 this.destination.complete();
47 return TakeSubscriber;
49 //# sourceMappingURL=take.js.map