UNPKG

es-toolkit

Version:

A state-of-the-art, high-performance JavaScript utility library with a small bundle size and strong type annotations.

11 lines (9 loc) 245 B
function keyBy(map, getKeyFromEntry) { const result = new Map(); for (const [key, value] of map) { const newKey = getKeyFromEntry(value, key, map); result.set(newKey, value); } return result; } export { keyBy };