2020-03-29 14:10:40 +00:00
|
|
|
<!-- Do not edit this file. It is automatically generated by API Documenter. -->
|
|
|
|
|
|
|
|
[Home](./index.md) > [@apextoaster/js-utils](./js-utils.md) > [getHeadOrDefault](./js-utils.getheadordefault.md)
|
|
|
|
|
|
|
|
## getHeadOrDefault() function
|
|
|
|
|
2020-03-31 13:29:47 +00:00
|
|
|
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
|
2021-07-10 21:54:41 +00:00
|
|
|
export declare function getHeadOrDefault<TKey, TVal>(map: Map<TKey, ReadonlyArray<Maybe<TVal>>>, key: TKey, defaultValue: TVal): TVal;
|
2020-03-29 14:10:40 +00:00
|
|
|
```
|
|
|
|
|
|
|
|
## Parameters
|
|
|
|
|
|
|
|
| Parameter | Type | Description |
|
|
|
|
| --- | --- | --- |
|
2021-07-10 21:54:41 +00:00
|
|
|
| map | Map<TKey, ReadonlyArray<[Maybe](./js-utils.maybe.md)<!-- --><TVal>>> | |
|
2020-06-29 23:23:16 +00:00
|
|
|
| key | TKey | |
|
|
|
|
| defaultValue | TVal | |
|
2020-03-29 14:10:40 +00:00
|
|
|
|
|
|
|
<b>Returns:</b>
|
|
|
|
|
2020-06-29 23:23:16 +00:00
|
|
|
TVal
|
2020-03-29 14:10:40 +00:00
|
|
|
|