Function: toArray()
toArray<
Value
>():Reducer
<Value
,Value
[]>
Returns a Reducer that collects values to an Array
.
Type Parameters
• 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' ]
Since
v0.0.1