API reference / @evolu/common / Array / firstInArray
Function: firstInArray()
function firstInArray<T>(array): T;
Defined in: packages/common/src/Array.ts:383
Returns the first element of a non-empty array.
Accepts both mutable and readonly arrays. Does not mutate the original array.
Example
firstInArray(["a", "b", "c"]); // "a"
Type Parameters
| Type Parameter |
|---|
T |
Parameters
| Parameter | Type |
|---|---|
array | readonly [T, T] |
Returns
T