<!-- Do not edit this file. It is automatically generated by API Documenter. -->

[Home](./index.md) &gt; [rc-js-util](./rc-js-util.md) &gt; [mapAddToSet](./rc-js-util.mapaddtoset_1.md)

## mapAddToSet() function

Used with maps that store sets. Where a set exists for a given key the value will be added to that set, otherwise a new set will be created containing the value.

**Signature:**

```typescript
export declare function mapAddToSet<TKey extends object, TValue>(map: WeakMap<TKey, Set<TValue>>, key: TKey, value: TValue): void;
```

## Parameters

<table><thead><tr><th>

Parameter


</th><th>

Type


</th><th>

Description


</th></tr></thead>
<tbody><tr><td>

map


</td><td>

WeakMap&lt;TKey, Set&lt;TValue&gt;&gt;


</td><td>

The `Map` to check. May be modified.


</td></tr>
<tr><td>

key


</td><td>

TKey


</td><td>

The key to lookup in `map`<!-- -->.


</td></tr>
<tr><td>

value


</td><td>

TValue


</td><td>

The value to add.


</td></tr>
</tbody></table>
**Returns:**

void

## Remarks

See [mapAddToSet()](./rc-js-util.mapaddtoset.md)<!-- -->.

