Function: toSet()
toSet<
Value
>():Reducer
<Value
,Set
<Value
>>
Returns a Reducer that collects values to a Set
.
Type Parameters
• 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'
//=> }
Since
v0.0.1