Code coverage report for cjs/observables/RangeObservable.js

Statements: 69.49% (41 / 59)      Branches: 56.67% (17 / 30)      Functions: 87.5% (7 / 8)      Lines: 71.43% (35 / 49)      Ignored: none     

All files » cjs/observables/ » RangeObservable.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 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83    1   1   4   1   1   1   1 1   1 4   4 4 4 4         1 4 4   4     1                                     1 3 3 3 3 3         3 23 2 2   21 21 1           1     1 1  
'use strict';
 
exports.__esModule = true;
 
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { 'default': obj }; }
 
function _classCallCheck(instance, Constructor) { Iif (!(instance instanceof Constructor)) { throw new TypeError('Cannot call a class as a function'); } }
 
function _inherits(subClass, superClass) { Iif (typeof superClass !== 'function' && superClass !== null) { throw new TypeError('Super expression must either be null or a function, not ' + typeof superClass); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, enumerable: false, writable: true, configurable: true } }); Eif (superClass) Object.setPrototypeOf ? Object.setPrototypeOf(subClass, superClass) : subClass.__proto__ = superClass; }
 
var _Observable2 = require('../Observable');
 
var _Observable3 = _interopRequireDefault(_Observable2);
 
var RangeObservable = (function (_Observable) {
    _inherits(RangeObservable, _Observable);
 
    function RangeObservable(start, end, scheduler) {
        _classCallCheck(this, RangeObservable);
 
        _Observable.call(this);
        this.start = start;
        this.end = end;
        this.scheduler = scheduler;
    }
 
    //# sourceMappingURL=RangeObservable.js.map
 
    RangeObservable.create = function create(start, end, scheduler) {
        Iif (start === undefined) start = 0;
        Iif (end === undefined) end = 0;
 
        return new RangeObservable(start, end, scheduler);
    };
 
    RangeObservable.dispatch = function dispatch(state) {
        var start = state.start;
        var index = state.index;
        var end = state.end;
        var subscriber = state.subscriber;
 
        if (index >= end) {
            subscriber.complete();
            return;
        }
        subscriber.next(start);
        if (subscriber.isUnsubscribed) {
            return;
        }
        state.index = index + 1;
        state.start = start + 1;
        this.schedule(state);
    };
 
    RangeObservable.prototype._subscribe = function _subscribe(subscriber) {
        var index = 0;
        var start = this.start;
        var end = this.end;
        var scheduler = this.scheduler;
        Iif (scheduler) {
            subscriber.add(scheduler.schedule(RangeObservable.dispatch, 0, {
                index: index, end: end, start: start, subscriber: subscriber
            }));
        } else {
            do {
                if (index++ >= end) {
                    subscriber.complete();
                    break;
                }
                subscriber.next(start++);
                if (subscriber.isUnsubscribed) {
                    break;
                }
            } while (true);
        }
    };
 
    return RangeObservable;
})(_Observable3['default']);
 
exports['default'] = RangeObservable;
module.exports = exports['default'];
//# sourceMappingURL=RangeObservable.js.map