Skip to main content

Function: toWeakSet()

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

Returns a Reducer that collects objects to a WeakSet.

Type Parameters

Value extends object

Returns

Reducer<Value, WeakSet<Value>>

Example

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

Defined in

collections.d.ts:69