Skip to main content

Variable: take

const take: Sub

Defined in: splices.d.ts:338

Returns an iterable containing the first count values of iterable in iteration order.

If the count is greater than the number of values in iterable, then an iterable equivalent iterable is returned.

Throws​

if count isn't a non-negative integer.

Example​

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

console.log(
pipe(
[`sloth`, `lazy`, `sleep`, `active`, `awake`],
take(3),
reduce(toArray()),
),
)
//=> [ 'sloth', 'lazy', 'sleep' ]
Playground

Since​

v0.0.1