Initial commit: Book management system with Rust Loco backend and Vue 3 frontend
This commit is contained in:
+17
@@ -0,0 +1,17 @@
|
||||
import { operate } from '../util/lift';
|
||||
import { createOperatorSubscriber } from './OperatorSubscriber';
|
||||
export function defaultIfEmpty(defaultValue) {
|
||||
return operate((source, subscriber) => {
|
||||
let hasValue = false;
|
||||
source.subscribe(createOperatorSubscriber(subscriber, (value) => {
|
||||
hasValue = true;
|
||||
subscriber.next(value);
|
||||
}, () => {
|
||||
if (!hasValue) {
|
||||
subscriber.next(defaultValue);
|
||||
}
|
||||
subscriber.complete();
|
||||
}));
|
||||
});
|
||||
}
|
||||
//# sourceMappingURL=defaultIfEmpty.js.map
|
||||
Reference in New Issue
Block a user