1 /** PURE_IMPORTS_START tslib,_Subscriber PURE_IMPORTS_END */
2 import * as tslib_1 from "tslib";
3 import { Subscriber } from '../Subscriber';
4 export function defaultIfEmpty(defaultValue) {
5 if (defaultValue === void 0) {
8 return function (source) { return source.lift(new DefaultIfEmptyOperator(defaultValue)); };
10 var DefaultIfEmptyOperator = /*@__PURE__*/ (function () {
11 function DefaultIfEmptyOperator(defaultValue) {
12 this.defaultValue = defaultValue;
14 DefaultIfEmptyOperator.prototype.call = function (subscriber, source) {
15 return source.subscribe(new DefaultIfEmptySubscriber(subscriber, this.defaultValue));
17 return DefaultIfEmptyOperator;
19 var DefaultIfEmptySubscriber = /*@__PURE__*/ (function (_super) {
20 tslib_1.__extends(DefaultIfEmptySubscriber, _super);
21 function DefaultIfEmptySubscriber(destination, defaultValue) {
22 var _this = _super.call(this, destination) || this;
23 _this.defaultValue = defaultValue;
27 DefaultIfEmptySubscriber.prototype._next = function (value) {
29 this.destination.next(value);
31 DefaultIfEmptySubscriber.prototype._complete = function () {
33 this.destination.next(this.defaultValue);
35 this.destination.complete();
37 return DefaultIfEmptySubscriber;
39 //# sourceMappingURL=defaultIfEmpty.js.map