Variable: toWeakMap()
consttoWeakMap: <Key,Value>() =>RawKeyedReducer<Key,Value,WeakMap<Key,Value>>
Defined in: collections.d.ts:173
Returns a KeyedReducer that collects key-value pairs to a WeakMap.
In the case of pairs with duplicate keys, the value of the last one wins.
Type Parameters
Key
Key extends object
Value
Value
Returns
RawKeyedReducer<Key, Value, WeakMap<Key, Value>>
Example
import { map, pipe, reduce, toWeakMap } from 'lfi'
console.log(
pipe(
[`sloth`, `lazy`, `sleep`],
map(word => [{ sloth: word }, word.length]),
reduce(toWeakMap()),
),
)
//=> WeakMap { <items unknown> }
Since
v0.0.1