1 | /**
|
2 | * Returns the first element in a sequence that satisfies a specified condition if provided, else
|
3 | * the first element in the sequence.
|
4 | * @param {Iterable<T>} source Source collection
|
5 | * @param {function:(value: T): boolean} [selector] An optional function to test each element for a condition.
|
6 | * @returns {T | undefined} The first element in the sequence that passes the test in the
|
7 | * specified predicate function if provided, else the first element. If there are no elements,
|
8 | * undefined is returned.
|
9 | */
|
10 | export declare function first<T, S extends T>(source: Iterable<T>, predicate: (value: T, index: number) => value is S): S | undefined;
|
11 | export declare function first<T>(source: Iterable<T>, predicate?: (value: T, index: number) => boolean): T | undefined;
|