UNPKG

@modern-kit/utils

Version:
18 lines (16 loc) 381 B
function uniq(arr, iteratee) { if (!iteratee) { return Array.from(new Set(arr)); } const map = /* @__PURE__ */ new Map(); for (let i = 0; i < arr.length; i++) { const item = arr[i]; const key = iteratee(item); if (!map.has(key)) { map.set(key, item); } } return Array.from(map.values()); } export { uniq }; //# sourceMappingURL=index.mjs.map