Skip to main content

Variable: toSet()

const toSet: <Value>() => Reducer<Value, Set<Value>>

Defined in: collections.d.ts:59

Returns a Reducer that collects values to a Set.

Type Parameters​

Value​

Value

Returns​

Reducer<Value, Set<Value>>

Example​

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

console.log(
pipe(
cycle([`sloth`, `lazy`, `sleep`]),
take(4),
reduce(toSet()),
),
)
//=> Set(3) {
//=> 'sloth',
//=> 'lazy',
//=> 'sleep'
//=> }
Playground

Since​

v0.0.1