UNPKG

iteragain

Version:

Javascript Iterable/Iterator/Generator-function utilities.

11 lines 800 B
import type { IteratorOrIterable, Predicate } from './types'; /** * Finds the first value that passes a truthy value to `predicate`, then returns it. Only consumes the iterator's * values up to the found value, then stops. So if it's not found, then the iterator is exhausted. */ export declare function find<T, V extends T>(arg: IteratorOrIterable<T>, predicate: (value: T) => value is V): V | undefined; export declare function find<T, V extends T>(predicate: (value: T) => value is V): (arg: IteratorOrIterable<T>) => V | undefined; export declare function find<T>(arg: IteratorOrIterable<T>, predicate: Predicate<T>): T | undefined; export declare function find<T>(predicate: Predicate<T>): (arg: IteratorOrIterable<T>) => T | undefined; export default find; //# sourceMappingURL=find.d.ts.map