diff options
Diffstat (limited to 'node_modules/rxjs/dist/esm5/internal/operators/throwIfEmpty.js')
| -rw-r--r-- | node_modules/rxjs/dist/esm5/internal/operators/throwIfEmpty.js | 17 |
1 files changed, 17 insertions, 0 deletions
diff --git a/node_modules/rxjs/dist/esm5/internal/operators/throwIfEmpty.js b/node_modules/rxjs/dist/esm5/internal/operators/throwIfEmpty.js new file mode 100644 index 0000000..e3179a3 --- /dev/null +++ b/node_modules/rxjs/dist/esm5/internal/operators/throwIfEmpty.js @@ -0,0 +1,17 @@ +import { EmptyError } from '../util/EmptyError'; +import { operate } from '../util/lift'; +import { createOperatorSubscriber } from './OperatorSubscriber'; +export function throwIfEmpty(errorFactory) { + if (errorFactory === void 0) { errorFactory = defaultErrorFactory; } + return operate(function (source, subscriber) { + var hasValue = false; + source.subscribe(createOperatorSubscriber(subscriber, function (value) { + hasValue = true; + subscriber.next(value); + }, function () { return (hasValue ? subscriber.complete() : subscriber.error(errorFactory())); })); + }); +} +function defaultErrorFactory() { + return new EmptyError(); +} +//# sourceMappingURL=throwIfEmpty.js.map
\ No newline at end of file |
