21 lines
No EOL
759 B
JavaScript
21 lines
No EOL
759 B
JavaScript
"use strict";
|
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
exports.defaultIfEmpty = void 0;
|
|
var lift_1 = require("../util/lift");
|
|
var OperatorSubscriber_1 = require("./OperatorSubscriber");
|
|
function defaultIfEmpty(defaultValue) {
|
|
return lift_1.operate(function (source, subscriber) {
|
|
var hasValue = false;
|
|
source.subscribe(OperatorSubscriber_1.createOperatorSubscriber(subscriber, function (value) {
|
|
hasValue = true;
|
|
subscriber.next(value);
|
|
}, function () {
|
|
if (!hasValue) {
|
|
subscriber.next(defaultValue);
|
|
}
|
|
subscriber.complete();
|
|
}));
|
|
});
|
|
}
|
|
exports.defaultIfEmpty = defaultIfEmpty;
|
|
//# sourceMappingURL=defaultIfEmpty.js.map
|