2 var __extends = (this && this.__extends) || (function () {
3 var extendStatics = function (d, b) {
4 extendStatics = Object.setPrototypeOf ||
5 ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
6 function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; };
7 return extendStatics(d, b);
9 return function (d, b) {
11 function __() { this.constructor = d; }
12 d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
15 Object.defineProperty(exports, "__esModule", { value: true });
16 var Subscriber_1 = require("../Subscriber");
17 var ArgumentOutOfRangeError_1 = require("../util/ArgumentOutOfRangeError");
18 var empty_1 = require("../observable/empty");
19 function take(count) {
20 return function (source) {
22 return empty_1.empty();
25 return source.lift(new TakeOperator(count));
30 var TakeOperator = (function () {
31 function TakeOperator(total) {
34 throw new ArgumentOutOfRangeError_1.ArgumentOutOfRangeError;
37 TakeOperator.prototype.call = function (subscriber, source) {
38 return source.subscribe(new TakeSubscriber(subscriber, this.total));
42 var TakeSubscriber = (function (_super) {
43 __extends(TakeSubscriber, _super);
44 function TakeSubscriber(destination, total) {
45 var _this = _super.call(this, destination) || this;
50 TakeSubscriber.prototype._next = function (value) {
51 var total = this.total;
52 var count = ++this.count;
54 this.destination.next(value);
55 if (count === total) {
56 this.destination.complete();
61 return TakeSubscriber;
62 }(Subscriber_1.Subscriber));
63 //# sourceMappingURL=take.js.map