Every new change
This commit is contained in:
39
node_modules/rxjs/_esm5/internal/operators/defaultIfEmpty.js
generated
vendored
Normal file
39
node_modules/rxjs/_esm5/internal/operators/defaultIfEmpty.js
generated
vendored
Normal file
@ -0,0 +1,39 @@
|
||||
/** PURE_IMPORTS_START tslib,_Subscriber PURE_IMPORTS_END */
|
||||
import * as tslib_1 from "tslib";
|
||||
import { Subscriber } from '../Subscriber';
|
||||
export function defaultIfEmpty(defaultValue) {
|
||||
if (defaultValue === void 0) {
|
||||
defaultValue = null;
|
||||
}
|
||||
return function (source) { return source.lift(new DefaultIfEmptyOperator(defaultValue)); };
|
||||
}
|
||||
var DefaultIfEmptyOperator = /*@__PURE__*/ (function () {
|
||||
function DefaultIfEmptyOperator(defaultValue) {
|
||||
this.defaultValue = defaultValue;
|
||||
}
|
||||
DefaultIfEmptyOperator.prototype.call = function (subscriber, source) {
|
||||
return source.subscribe(new DefaultIfEmptySubscriber(subscriber, this.defaultValue));
|
||||
};
|
||||
return DefaultIfEmptyOperator;
|
||||
}());
|
||||
var DefaultIfEmptySubscriber = /*@__PURE__*/ (function (_super) {
|
||||
tslib_1.__extends(DefaultIfEmptySubscriber, _super);
|
||||
function DefaultIfEmptySubscriber(destination, defaultValue) {
|
||||
var _this = _super.call(this, destination) || this;
|
||||
_this.defaultValue = defaultValue;
|
||||
_this.isEmpty = true;
|
||||
return _this;
|
||||
}
|
||||
DefaultIfEmptySubscriber.prototype._next = function (value) {
|
||||
this.isEmpty = false;
|
||||
this.destination.next(value);
|
||||
};
|
||||
DefaultIfEmptySubscriber.prototype._complete = function () {
|
||||
if (this.isEmpty) {
|
||||
this.destination.next(this.defaultValue);
|
||||
}
|
||||
this.destination.complete();
|
||||
};
|
||||
return DefaultIfEmptySubscriber;
|
||||
}(Subscriber));
|
||||
//# sourceMappingURL=defaultIfEmpty.js.map
|
Reference in New Issue
Block a user