Variable: first()
constfirst: <Value>(iterable) =>Optional<Value>
Defined in: splices.d.ts:469
Returns an iterable containing the first value of iterable, or an empty
iterable if iterable is empty.
Type Parameters
Value
Value
Parameters
iterable
Iterable<Value>
Returns
Optional<Value>
Example
import { first, or, pipe } from 'lfi'
console.log(
pipe(
[`sloth`, `lazy`, `sleep`],
first,
or(() => `empty`),
),
)
//=> sloth
console.log(
pipe(
[],
first,
or(() => `empty`),
),
)
//=> empty
Since
v0.0.1