Files
cannaiq/frontend/node_modules/es-toolkit/dist/array/uniqBy.js
2025-11-28 19:45:44 -07:00

18 lines
395 B
JavaScript

'use strict';
Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });
function uniqBy(arr, mapper) {
const map = new Map();
for (let i = 0; i < arr.length; i++) {
const item = arr[i];
const key = mapper(item);
if (!map.has(key)) {
map.set(key, item);
}
}
return Array.from(map.values());
}
exports.uniqBy = uniqBy;