Code coverage report for cjs/operator/toPromise.js

Statements: 82.35% (14 / 17)      Branches: 63.64% (7 / 11)      Functions: 100% (5 / 5)      Lines: 78.57% (11 / 14)      Ignored: none     

All files » cjs/operator/ » toPromise.js
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 211 1 3 3 1 1           3     3 3 4     1  
var root_1 = require('../util/root');
function toPromise(PromiseCtor) {
    var _this = this;
    if (!PromiseCtor) {
        Eif (root_1.root.Rx && root_1.root.Rx.config && root_1.root.Rx.config.Promise) {
            PromiseCtor = root_1.root.Rx.config.Promise;
        }
        else if (root_1.root.Promise) {
            PromiseCtor = root_1.root.Promise;
        }
    }
    Iif (!PromiseCtor) {
        throw new Error('no Promise impl found');
    }
    return new PromiseCtor(function (resolve, reject) {
        var value;
        _this.subscribe(function (x) { return value = x; }, function (err) { return reject(err); }, function () { return resolve(value); });
    });
}
exports.toPromise = toPromise;
//# sourceMappingURL=toPromise.js.map