import { OptionalFindOptions } from './findoptions' ; template T param { Iterable < T > } source returns { ( S | undefined ) } export function first < T > ( source , options ? ) { const { [ 'thisArg' ] : thisArg , [ 'predicate' ] : predicate = ( ) => true } = options || { } ; let i = 0 ; for ( const item of source ) { if ( predicate ! . call ( thisArg , item , i ++ ) ) { return item ; } } return undefined ; }