Skip to content
Branch: master
Find file Copy path
Find file Copy path
Fetching contributors…
Cannot retrieve contributors at this time
executable file 14 lines (9 sloc) 301 Bytes
import { findIndex } from './find-index';
type FindCallback<T> = (value: T, index: number, array: T[]) => boolean;
export function find<T>(array: T[], callback: FindCallback<T>) {
const index = findIndex(array, callback);
if (index === -1) {
return undefined;
return array[index];
You can’t perform that action at this time.