Code coverage report for RxJS/dist/cjs/operators/groupBy-support.js

Statements: 96.92% (63 / 65)      Branches: 79.41% (27 / 34)      Functions: 100% (13 / 13)      Lines: 100% (57 / 57)      Ignored: none     

All files » RxJS/dist/cjs/operators/ » groupBy-support.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 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100    1   2   267   3   1   1   1   1   1 1   1 34   34 34 34     1 34     1 36 33 33 30 30         1     1   1 1   1 156   156 156 156 156     1 138 138 77   138 138     1     1   1 1   1 77   77 77 77     1 77 77 77 77 3 3         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 _Subscription3 = require('../Subscription');
 
var _Subscription4 = _interopRequireDefault(_Subscription3);
 
var _Observable2 = require('../Observable');
 
var _Observable3 = _interopRequireDefault(_Observable2);
 
var RefCountSubscription = (function (_Subscription) {
    _inherits(RefCountSubscription, _Subscription);
 
    function RefCountSubscription() {
        _classCallCheck(this, RefCountSubscription);
 
        _Subscription.call(this);
        this.attemptedToUnsubscribePrimary = false;
        this.count = 0;
    }
 
    RefCountSubscription.prototype.setPrimary = function setPrimary(subscription) {
        this.primary = subscription;
    };
 
    RefCountSubscription.prototype.unsubscribe = function unsubscribe() {
        if (!this.isUnsubscribed && !this.attemptedToUnsubscribePrimary) {
            this.attemptedToUnsubscribePrimary = true;
            if (this.count === 0) {
                _Subscription.prototype.unsubscribe.call(this);
                this.primary.unsubscribe();
            }
        }
    };
 
    return RefCountSubscription;
})(_Subscription4['default']);
 
exports.RefCountSubscription = RefCountSubscription;
 
var GroupedObservable = (function (_Observable) {
    _inherits(GroupedObservable, _Observable);
 
    function GroupedObservable(key, groupSubject, refCountSubscription) {
        _classCallCheck(this, GroupedObservable);
 
        _Observable.call(this);
        this.key = key;
        this.groupSubject = groupSubject;
        this.refCountSubscription = refCountSubscription;
    }
 
    GroupedObservable.prototype._subscribe = function _subscribe(subscriber) {
        var subscription = new _Subscription4['default']();
        if (this.refCountSubscription && !this.refCountSubscription.isUnsubscribed) {
            subscription.add(new InnerRefCountSubscription(this.refCountSubscription));
        }
        subscription.add(this.groupSubject.subscribe(subscriber));
        return subscription;
    };
 
    return GroupedObservable;
})(_Observable3['default']);
 
exports.GroupedObservable = GroupedObservable;
 
var InnerRefCountSubscription = (function (_Subscription2) {
    _inherits(InnerRefCountSubscription, _Subscription2);
 
    function InnerRefCountSubscription(parent) {
        _classCallCheck(this, InnerRefCountSubscription);
 
        _Subscription2.call(this);
        this.parent = parent;
        parent.count++;
    }
 
    InnerRefCountSubscription.prototype.unsubscribe = function unsubscribe() {
        Eif (!this.parent.isUnsubscribed && !this.isUnsubscribed) {
            _Subscription2.prototype.unsubscribe.call(this);
            this.parent.count--;
            if (this.parent.count === 0 && this.parent.attemptedToUnsubscribePrimary) {
                this.parent.unsubscribe();
                this.parent.primary.unsubscribe();
            }
        }
    };
 
    return InnerRefCountSubscription;
})(_Subscription4['default']);
 
exports.InnerRefCountSubscription = InnerRefCountSubscription;