Skip to main content

Variable: toWeakSet()

const toWeakSet: <Value>() => Reducer<Value, WeakSet<Value>>

Defined in: collections.d.ts:82

Returns a Reducer that collects objects to a WeakSet.

Type Parameters​

Value​

Value extends object

Returns​

Reducer<Value, WeakSet<Value>>

Example​

import { cycle, map, pipe, reduce, take, toWeakSet } from 'lfi'

console.log(
pipe(
cycle([`sloth`, `lazy`, `sleep`]),
take(4),
map(word => ({ sloth: word })),
reduce(toWeakSet()),
),
)
//=> WeakSet { <items unknown> }
Playground

Since​

v0.0.1