Code coverage report for cjs/operator/takeWhile.js

Statements: 100% (34 / 34)      Branches: 81.82% (9 / 11)      Functions: 100% (9 / 9)      Lines: 100% (31 / 31)      Ignored: none     

All files » cjs/operator/ » takeWhile.js
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 441 2 1 1   1 1 1 1 18   1 1 1 18   1 18   1   1 1 1 18 18 18   1 34 34 34 1   33 27     6     1    
var __extends = (this && this.__extends) || function (d, b) {
    for (var p in b) Eif (b.hasOwnProperty(p)) d[p] = b[p];
    function __() { this.constructor = d; }
    d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
};
var Subscriber_1 = require('../Subscriber');
var tryCatch_1 = require('../util/tryCatch');
var errorObject_1 = require('../util/errorObject');
function takeWhile(predicate) {
    return this.lift(new TakeWhileOperator(predicate));
}
exports.takeWhile = takeWhile;
var TakeWhileOperator = (function () {
    function TakeWhileOperator(predicate) {
        this.predicate = predicate;
    }
    TakeWhileOperator.prototype.call = function (subscriber) {
        return new TakeWhileSubscriber(subscriber, this.predicate);
    };
    return TakeWhileOperator;
})();
var TakeWhileSubscriber = (function (_super) {
    __extends(TakeWhileSubscriber, _super);
    function TakeWhileSubscriber(destination, predicate) {
        _super.call(this, destination);
        this.predicate = predicate;
        this.index = 0;
    }
    TakeWhileSubscriber.prototype._next = function (value) {
        var destination = this.destination;
        var result = tryCatch_1.tryCatch(this.predicate)(value, this.index++);
        if (result == errorObject_1.errorObject) {
            destination.error(errorObject_1.errorObject.e);
        }
        else if (Boolean(result)) {
            destination.next(value);
        }
        else {
            destination.complete();
        }
    };
    return TakeWhileSubscriber;
})(Subscriber_1.Subscriber);
//# sourceMappingURL=takeWhile.js.map