Debian Codegraph @

node/rxjs/dist/cjs/internal/operators/throwIfEmpty.js

raw
1 "use strict";
2 Object.defineProperty(exports, "__esModule", { value: true });
3 exports.throwIfEmpty = void 0;
4 var EmptyError_1 = require("../util/EmptyError");
5 var lift_1 = require("../util/lift");
6 var OperatorSubscriber_1 = require("./OperatorSubscriber");
7 function throwIfEmpty(errorFactory) {
8 if (errorFactory === void 0) { errorFactory = defaultErrorFactory; }
9 return lift_1.operate(function (source, subscriber) {
10 var hasValue = false;
11 source.subscribe(OperatorSubscriber_1.createOperatorSubscriber(subscriber, function (value) {
12 hasValue = true;
13 subscriber.next(value);
14 }, function () { return (hasValue ? subscriber.complete() : subscriber.error(errorFactory())); }));
15 });
16 }
17 exports.throwIfEmpty = throwIfEmpty;
18 function defaultErrorFactory() {
19 return new EmptyError_1.EmptyError();
20 }
21 //# sourceMappingURL=throwIfEmpty.js.map