UNPKG

@modern-kit/utils

Version:
20 lines (17 loc) 400 B
'use strict'; 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()); } exports.uniq = uniq; //# sourceMappingURL=index.cjs.map