1 import { Observable } from '../Observable';
2 import { MonoTypeOperatorFunction } from '../types';
4 * Returns an Observable that emits the single item emitted by the source Observable that matches a specified
5 * predicate, if that Observable emits one such item. If the source Observable emits more than one such item or no
6 * items, notify of an IllegalArgumentException or NoSuchElementException respectively. If the source Observable
7 * emits items but none match the specified predicate then `undefined` is emitted.
9 * <span class="informal">Like {@link first}, but emit with error notification if there is more than one value.</span>
15 * import { range } from 'rxjs';
16 * import { single } from 'rxjs/operators';
18 * const numbers = range(1,5).pipe(single());
19 * numbers.subscribe(x => console.log('never get called'), e => console.log('error'));
26 * import { range } from 'rxjs';
27 * import { single } from 'rxjs/operators';
29 * const numbers = range(1,5).pipe(single(x => x === 10));
30 * numbers.subscribe(x => console.log(x));
37 * @see {@link findIndex}
38 * @see {@link elementAt}
40 * @throws {EmptyError} Delivers an EmptyError to the Observer's `error`
41 * callback if the Observable completes before any `next` notification was sent.
42 * @param {Function} predicate - A predicate function to evaluate items emitted by the source Observable.
43 * @return {Observable<T>} An Observable that emits the single item emitted by the source Observable that matches
44 * the predicate or `undefined` when no items match.
49 export declare function single<T>(predicate?: (value: T, index: number, source: Observable<T>) => boolean): MonoTypeOperatorFunction<T>;