27 lines
795 B
Markdown
27 lines
795 B
Markdown
<!-- Do not edit this file. It is automatically generated by API Documenter. -->
|
|
|
|
[Home](./index.md) > [@apextoaster/js-utils](./js-utils.md) > [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<TKey, Array<TVal>></code> | The destination map and source of existing values. |
|
|
| key | <code>TKey</code> | The key to get and set. |
|
|
| val | <code>TVal | Array<TVal></code> | The value to add. |
|
|
|
|
<b>Returns:</b>
|
|
|
|
`void`
|
|
|