source: node_modules/es-toolkit/dist/set/countBy.mjs

Last change on this file was a762898, checked in by istevanoska <ilinastevanoska@…>, 5 months ago

Added visualizations

  • Property mode set to 100644
File size: 259 bytes
Line 
1function countBy(set, mapper) {
2 const result = new Map();
3 for (const value of set) {
4 const mappedKey = mapper(value, value, set);
5 result.set(mappedKey, (result.get(mappedKey) ?? 0) + 1);
6 }
7 return result;
8}
9
10export { countBy };
Note: See TracBrowser for help on using the repository browser.