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

27 lines
705 B
Markdown

<!-- 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, Array<TVal>>, key: TKey, val: TVal | Array<TVal>): void;
```
## Parameters
| Parameter | Type | Description |
| --- | --- | --- |
| map | <code>Map&lt;TKey, Array&lt;TVal&gt;&gt;</code> | |
| key | <code>TKey</code> | |
| val | <code>TVal &#124; Array&lt;TVal&gt;</code> | |
<b>Returns:</b>
`void`