1
0
Fork 0
js-utils/docs/api/js-utils.setorpush.md

27 lines
846 B
Markdown
Raw Normal View History

2020-03-29 13:43:52 +00:00
<!-- Do not edit this file. It is automatically generated by API Documenter. -->
[Home](./index.md) &gt; [@apextoaster/js-utils](./js-utils.md) &gt; [setOrPush](./js-utils.setorpush.md)
## setOrPush() function
Set a map key to a new array or push to the existing value.
<b>Signature:</b>
```typescript
export declare function setOrPush<TKey, TVal>(map: Map<TKey, ReadonlyArray<TVal>>, key: TKey, val: TVal | ReadonlyArray<TVal>): Map<TKey, ReadonlyArray<TVal>>;
2020-03-29 13:43:52 +00:00
```
## Parameters
| Parameter | Type | Description |
| --- | --- | --- |
| map | Map&lt;TKey, ReadonlyArray&lt;TVal&gt;&gt; | The destination map and source of existing values. |
| key | TKey | The key to get and set. |
| val | TVal \| ReadonlyArray&lt;TVal&gt; | The value to add. |
2020-03-29 13:43:52 +00:00
<b>Returns:</b>
Map&lt;TKey, ReadonlyArray&lt;TVal&gt;&gt;
2020-03-29 13:43:52 +00:00