Code coverage report for cjs/Notification.js

Statements: 70% (35 / 50)      Branches: 42.86% (9 / 21)      Functions: 72.73% (8 / 11)      Lines: 70.21% (33 / 47)      Ignored: none     

All files » cjs/ » Notification.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    1   1   8027   1   1   1 1 8027   8027 8027 8027 8027     1 4313   3384   233   696       1                       1               1                         1 7314 7253   61     1 772     1 1792     1     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'); } }
 
var _Observable = require('./Observable');
 
var _Observable2 = _interopRequireDefault(_Observable);
 
var Notification = (function () {
    function Notification(kind, value, exception) {
        _classCallCheck(this, Notification);
 
        this.kind = kind;
        this.value = value;
        this.exception = exception;
        this.hasValue = kind === 'N';
    }
 
    Notification.prototype.observe = function observe(observer) {
        switch (this.kind) {
            case 'N':
                return observer.next(this.value);
            case 'E':
                return observer.error(this.exception);
            case 'C':
                return observer.complete();
        }
    };
 
    Notification.prototype['do'] = function _do(next, error, complete) {
        var kind = this.kind;
        switch (kind) {
            case 'N':
                return next(this.value);
            case 'E':
                return error(this.exception);
            case 'C':
                return complete();
        }
    };
 
    Notification.prototype.accept = function accept(nextOrObserver, error, complete) {
        if (nextOrObserver && typeof nextOrObserver.next === 'function') {
            return this.observe(nextOrObserver);
        } else {
            return this['do'](nextOrObserver, error, complete);
        }
    };
 
    Notification.prototype.toObservable = function toObservable() {
        var kind = this.kind;
        var value = this.value;
        switch (kind) {
            case 'N':
                return _Observable2['default'].of(value);
            case 'E':
                return _Observable2['default']['throw'](value);
            case 'C':
                return _Observable2['default'].empty();
        }
    };
 
    Notification.createNext = function createNext(value) {
        if (typeof value !== 'undefined') {
            return new Notification('N', value);
        }
        return this.undefinedValueNotification;
    };
 
    Notification.createError = function createError(err) {
        return new Notification('E', undefined, err);
    };
 
    Notification.createComplete = function createComplete() {
        return this.completeNotification;
    };
 
    return Notification;
})();
 
exports['default'] = Notification;
 
Notification.completeNotification = new Notification('C');
Notification.undefinedValueNotification = new Notification('N', undefined);
//# sourceMappingURL=Notification.js.map
module.exports = exports['default'];
//# sourceMappingURL=Notification.js.map