js-fns
Version:
Modern JavaScript utility library focused on the build size
12 lines (11 loc) • 405 B
TypeScript
/**
* Returns the first matching element.
*
* @param array - The array to find element in
* @param matcher - The function that returns true if element satisfies a condition
* @returns An element that satisfies the condition
*
* @category Array
* @public
*/
export default function find<ElementType>(array: Array<ElementType>, matcher: (element: ElementType) => boolean): ElementType | undefined;