Home > rc-js-util > arrayIndex
Populates a Map
given a key creating function and ArrayLike
.
Signature:
export declare function arrayIndex<TKey, TItem>(items: ArrayLike<TItem>, getKey: (item: TItem, index: number) => TKey | null): Map<Exclude<TKey, null>, TItem>;
Parameter | Type | Description |
---|---|---|
items | ArrayLike<TItem> | |
getKey | (item: TItem, index: number) => TKey | null |
Returns:
Map<Exclude<TKey, null>, TItem>
keys which are null are omitted.
See arrayIndex().