basant307/AI_Governance_Project
048
1function countBy(map, mapper) {2 const result = new Map();3 for (const [key, value] of map) {4 const mappedKey = mapper(value, key, map);5 result.set(mappedKey, (result.get(mappedKey) ?? 0) + 1);6 }7 return result;8}9 10export { countBy };11 