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

805 B

Home > @apextoaster/js-utils > getHeadOrDefault

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.

Signature:

export declare function getHeadOrDefault<TKey, TVal>(map: Map<TKey, Array<Optional<TVal>>>, key: TKey, defaultValue: TVal): TVal;

Parameters

Parameter Type Description
map Map<TKey, Array<Optional<TVal>>>
key TKey
defaultValue TVal

Returns:

TVal