Skip to main content

Variable: takeWhile

const takeWhile: SubWhile

Defined in: splices.d.ts:117

Returns an iterable containing the values of iterable in iteration order up until but not including the first value for which fn returns a falsy value.

Example

import { pipe, reduce, takeWhile, toArray } from 'lfi'

console.log(
pipe(
[`sloth`, `lazy`, `active`, `sleep`, `awake`],
takeWhile(word => word.includes(`l`)),
reduce(toArray()),
),
)
//=> [ 'sloth', 'lazy' ]
Playground

Since

v0.0.1