Skip to main content

Variable: toArray()

const toArray: <Value>() => Reducer<Value, Value[]>

Defined in: collections.d.ts:33

Returns a Reducer that collects values to an Array.

Type Parameters​

Value​

Value

Returns​

Reducer<Value, Value[]>

Example​

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

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

Since​

v0.0.1