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

27 lines
805 B
Markdown

<!-- 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.
<b>Signature:</b>
```typescript
export declare function getHeadOrDefault<TKey, TVal>(map: Map<TKey, ReadonlyArray<Maybe<TVal>>>, key: TKey, defaultValue: TVal): TVal;
```
## Parameters
| Parameter | Type | Description |
| --- | --- | --- |
| map | Map&lt;TKey, ReadonlyArray&lt;[Maybe](./js-utils.maybe.md)<!-- -->&lt;TVal&gt;&gt;&gt; | |
| key | TKey | |
| defaultValue | TVal | |
<b>Returns:</b>
TVal