first
Callable
Type parameters
- T: Traversable<unknown, unknown> | readonly unknown[]
The element type.
Parameters
xs: T
The traversable to find the element in.
Returns T extends readonly [infer N0, ...unknown[]] ? N0 : Maybe<IterableElement<T>>
The first element of the traversable, otherwise Nothing.
- T: Traversable<unknown, unknown> | readonly unknown[]
Return the first element of a traversable, or Nothing if the traversable is empty.
The
first
function is a good example of how to use the at function. It's also a good example of how to use the Maybe type.Example
at