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

27 lines
686 B
Markdown
Raw Normal View History

2020-03-29 14:10:40 +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; [getOrDefault](./js-utils.getordefault.md)
## getOrDefault() function
Get a map key or default value when the key does not exist or is nil.
2020-03-29 14:10:40 +00:00
<b>Signature:</b>
```typescript
export declare function getOrDefault<TKey, TVal>(map: Map<TKey, TVal>, key: TKey, defaultValue: TVal): TVal;
```
## Parameters
| Parameter | Type | Description |
| --- | --- | --- |
| map | <code>Map&lt;TKey, TVal&gt;</code> | |
| key | <code>TKey</code> | |
| defaultValue | <code>TVal</code> | |
<b>Returns:</b>
`TVal`