mirror of
https://github.com/bigcapitalhq/bigcapital.git
synced 2026-02-16 21:00:31 +00:00
8 lines
205 B
TypeScript
8 lines
205 B
TypeScript
export const transformToMapKeyValue = <T, K extends string | number>(
|
|
collection: T[],
|
|
key: keyof T,
|
|
): Map<K, T> => {
|
|
// @ts-ignore
|
|
return new Map(collection.map((item) => [item[key], item]));
|
|
};
|