21 lines
637 B
JavaScript
21 lines
637 B
JavaScript
"use strict";
|
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
var tap_1 = require("./tap");
|
|
var EmptyError_1 = require("../util/EmptyError");
|
|
exports.throwIfEmpty = function (errorFactory) {
|
|
if (errorFactory === void 0) { errorFactory = defaultErrorFactory; }
|
|
return tap_1.tap({
|
|
hasValue: false,
|
|
next: function () { this.hasValue = true; },
|
|
complete: function () {
|
|
if (!this.hasValue) {
|
|
throw errorFactory();
|
|
}
|
|
}
|
|
});
|
|
};
|
|
function defaultErrorFactory() {
|
|
return new EmptyError_1.EmptyError();
|
|
}
|
|
//# sourceMappingURL=throwIfEmpty.js.map
|