This repository has been archived on 2026-03-28. You can view files and clone it. You cannot open issues or pull requests or push a commit.
Files
StasisWarden-Legacy/node_modules/es-toolkit/dist/array/countBy.mjs
T

12 lines
255 B
JavaScript

function countBy(arr, mapper) {
const result = {};
for (let i = 0; i < arr.length; i++) {
const item = arr[i];
const key = mapper(item);
result[key] = (result[key] ?? 0) + 1;
}
return result;
}
export { countBy };