2020-03-29 13:43:52 +00:00
|
|
|
<!-- 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
|
2020-06-30 13:16:22 +00:00
|
|
|
export declare function setOrPush<TKey, TVal>(map: Map<TKey, ReadonlyArray<TVal>>, key: TKey, val: TVal | ReadonlyArray<TVal>): void;
|
2020-03-29 13:43:52 +00:00
|
|
|
```
|
|
|
|
|
|
|
|
## Parameters
|
|
|
|
|
|
|
|
| Parameter | Type | Description |
|
|
|
|
| --- | --- | --- |
|
2020-06-30 13:16:22 +00:00
|
|
|
| map | Map<TKey, ReadonlyArray<TVal>> | The destination map and source of existing values. |
|
2020-06-29 23:23:16 +00:00
|
|
|
| key | TKey | The key to get and set. |
|
2020-06-30 13:16:22 +00:00
|
|
|
| val | TVal \| ReadonlyArray<TVal> | The value to add. |
|
2020-03-29 13:43:52 +00:00
|
|
|
|
|
|
|
<b>Returns:</b>
|
|
|
|
|
2020-06-29 23:23:16 +00:00
|
|
|
void
|
2020-03-29 13:43:52 +00:00
|
|
|
|