Skip to content

Welshman Docs / @welshman/lib / indexBy

Function: indexBy() ​

indexBy<T, K>(f, xs): Map<K, T>

Defined in: packages/lib/src/Tools.ts:637

Creates map from array using key function

Type Parameters ​

T ​

T

K ​

K

Parameters ​

f ​

(x) => K

Function to generate key

xs ​

T[]

Array to index

Returns ​

Map<K, T>

Map of values by key