27 lines
645 B
Markdown
27 lines
645 B
Markdown
<!-- Do not edit this file. It is automatically generated by API Documenter. -->
|
|
|
|
[Home](./index.md) > [@apextoaster/js-utils](./js-utils.md) > [getOrDefault](./js-utils.getordefault.md)
|
|
|
|
## getOrDefault() function
|
|
|
|
Get a map key or default value when the key does not exist or is nil.
|
|
|
|
<b>Signature:</b>
|
|
|
|
```typescript
|
|
export declare function getOrDefault<TKey, TVal>(map: Map<TKey, TVal>, key: TKey, defaultValue: TVal): TVal;
|
|
```
|
|
|
|
## Parameters
|
|
|
|
| Parameter | Type | Description |
|
|
| --- | --- | --- |
|
|
| map | Map<TKey, TVal> | |
|
|
| key | TKey | |
|
|
| defaultValue | TVal | |
|
|
|
|
<b>Returns:</b>
|
|
|
|
TVal
|
|
|