mirror of
https://git.meshkee.com/cssd/cssd-back.git
synced 2026-10-11 12:11:05 +03:30
15 lines
416 B
JavaScript
Vendored
15 lines
416 B
JavaScript
Vendored
import { tap } from './tap';
|
|
import { EmptyError } from '../util/EmptyError';
|
|
export const throwIfEmpty = (errorFactory = defaultErrorFactory) => tap({
|
|
hasValue: false,
|
|
next() { this.hasValue = true; },
|
|
complete() {
|
|
if (!this.hasValue) {
|
|
throw errorFactory();
|
|
}
|
|
}
|
|
});
|
|
function defaultErrorFactory() {
|
|
return new EmptyError();
|
|
}
|
|
//# sourceMappingURL=throwIfEmpty.js.map
|