Skip to content

Latest commit

 

History

History
36 lines (19 loc) · 588 Bytes

first.md

File metadata and controls

36 lines (19 loc) · 588 Bytes

@serenity-is/corelib / first

Function: first()

first<TItem>(array, predicate): TItem

Gets first element in an array that matches given predicate similar to LINQ's First. Throws an error if no match is found.

Type Parameters

TItem

Parameters

array

TItem[]

Array to test.

predicate

(x) => boolean

Predicate to test elements.

Returns

TItem

First element that matches.

Defined in

src/q/arrays-compat.ts:32