es-toolkit
Version:
A state-of-the-art, high-performance JavaScript utility library with a small bundle size and strong type annotations.
15 lines (11 loc) • 333 B
JavaScript
;
Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });
function mapKeys(map, getNewKey) {
const result = new Map();
for (const [key, value] of map) {
const newKey = getNewKey(value, key, map);
result.set(newKey, value);
}
return result;
}
exports.mapKeys = mapKeys;