Skip to main content

Function: toArray()

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

Returns a Reducer that collects values to an Array.

Type Parameters

Value

Returns

Reducer<Value, Value[]>

Example

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

Defined in

collections.d.ts:30