Skip to content

Function: arrayFirst() ​

arrayFirst<T>(array, callback?, defaultValue?): T | undefined

Defined in: src/arrays.ts:100

Return the first element in an array passing a given truth test.

Type Parameters ​

T ​

T

Parameters ​

array ​

T[]

The source array

callback? ​

(item, index) => boolean

Optional callback for truth test

defaultValue? ​

T

Optional default value if no element found

Returns ​

T | undefined

The first matching element or default value

Documentation of 1.0.13 , built from cf61d3b on 1.0.13 by pipeline #2985011498 on 2026-10-21.