Variable: find
const
find:Find
Defined in: filters.d.ts:679
Returns an iterable containing the first value of iterable
for which fn
returns a truthy value. Otherwise, returns an empty iterable.
Like Array.prototype.find
, but for iterables.
Example
import { find, or, pipe } from 'lfi'
console.log(
pipe(
[`sloth`, `lazy`, `sleep`],
find(word => word.includes(`s`)),
or(() => `not found!`),
),
)
//=> sloth
console.log(
pipe(
[`sloth`, `lazy`, `sleep`],
find(word => word.includes(`x`)),
or(() => `not found!`),
),
)
//=> not found!
Since
v0.0.1