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:836

Creates map from array using key function

Type Parameters ​

• T

• K

Parameters ​

f ​

(x) => K

Function to generate key

xs ​

T[]

Array to index

Returns ​

Map<K, T>

Map of values by key