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

27 lines
814 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; [getHeadOrDefault](./js-utils.getheadordefault.md)
## getHeadOrDefault() function
Get the first element from the specified key, within a map of lists, or a 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 getHeadOrDefault<TKey, TVal>(map: Map<TKey, ReadonlyArray<Optional<TVal>>>, key: TKey, defaultValue: TVal): TVal;
2020-03-29 14:10:40 +00:00
```
## Parameters
| Parameter | Type | Description |
| --- | --- | --- |
| map | Map&lt;TKey, ReadonlyArray&lt;[Optional](./js-utils.optional.md)<!-- -->&lt;TVal&gt;&gt;&gt; | |
| key | TKey | |
| defaultValue | TVal | |
2020-03-29 14:10:40 +00:00
<b>Returns:</b>
TVal
2020-03-29 14:10:40 +00:00