@techmely/utils
Version:
Collection of helpful JavaScript / TypeScript utils
22 lines (19 loc) • 418 B
JavaScript
/*!
* @techmely/utils
* Copyright(c) 2021-2024 Techmely <techmely.creation@gmail.com>
* MIT Licensed
*/
;
(() => {
// src/uniqueObject.ts
function uniqueObj(items, uniqueKey) {
const map = /* @__PURE__ */ new Map();
for (const item of items) {
const key = item[uniqueKey];
if (!map.has(key)) {
map.set(key, item);
}
}
return [...map.values()];
}
})();