UNPKG

848 BTypeScriptView Raw
1import { OptionalFindOptions } from './findoptions';
2/**
3 * Returns the only element of an iterable sequence that matches the predicate if specified,
4 * or undefined if no such element exists; this method reports an exception if there is more
5 * than one element in the iterable sequence.
6 *
7 * @export
8 * @template T The type of the elements in the source sequence.
9 * @param {AsyncIterable<T>} source Source iterable sequence.
10 * @param {OptionalFindOptions<T>} [options] The optional options which includes a predicate for filtering,
11 * and thisArg for predicate binding.
12 * @returns {(T | undefined)} The single element in the iterable sequence that satisfies
13 * the condition in the predicate, or undefined if no such element exists.
14 */
15export declare function single<T>(source: Iterable<T>, options?: OptionalFindOptions<T>): T | undefined;