single.js 1.0 KB

123456789101112131415161718192021222324
  1. "use strict";
  2. Object.defineProperty(exports, "__esModule", { value: true });
  3. var operators_1 = require("rxjs/operators");
  4. /**
  5. * Returns an Observable that emits the single item emitted by the source Observable that matches a specified
  6. * predicate, if that Observable emits one such item. If the source Observable emits more than one such item or no
  7. * such items, notify of an IllegalArgumentException or NoSuchElementException respectively.
  8. *
  9. * <img src="./img/single.png" width="100%">
  10. *
  11. * @throws {EmptyError} Delivers an EmptyError to the Observer's `error`
  12. * callback if the Observable completes before any `next` notification was sent.
  13. * @param {Function} predicate - A predicate function to evaluate items emitted by the source Observable.
  14. * @return {Observable<T>} An Observable that emits the single item emitted by the source Observable that matches
  15. * the predicate.
  16. .
  17. * @method single
  18. * @owner Observable
  19. */
  20. function single(predicate) {
  21. return operators_1.single(predicate)(this);
  22. }
  23. exports.single = single;
  24. //# sourceMappingURL=single.js.map