es-toolkit
Advanced tools
Comparing version 1.3.1-dev.79 to 1.3.1-dev.80
@@ -240,3 +240,3 @@ "use strict"; | ||
} | ||
return [...map.values()]; | ||
return Array.from(map.values()); | ||
} | ||
@@ -263,3 +263,10 @@ | ||
function uniqBy(arr, mapper) { | ||
return uniqWith(arr, (item1, item2) => mapper(item1) === mapper(item2)); | ||
const map = /* @__PURE__ */ new Map(); | ||
for (const item of arr) { | ||
const key = mapper(item); | ||
if (!map.has(key)) { | ||
map.set(key, item); | ||
} | ||
} | ||
return Array.from(map.values()); | ||
} | ||
@@ -266,0 +273,0 @@ |
@@ -34,3 +34,3 @@ "use strict"; | ||
} | ||
return [...map.values()]; | ||
return Array.from(map.values()); | ||
} | ||
@@ -37,0 +37,0 @@ // Annotate the CommonJS export names for ESM import in node: |
@@ -26,19 +26,12 @@ "use strict"; | ||
module.exports = __toCommonJS(uniqBy_exports); | ||
// src/array/uniqWith.ts | ||
function uniqWith(arr, areItemsEqual) { | ||
const result = []; | ||
function uniqBy(arr, mapper) { | ||
const map = /* @__PURE__ */ new Map(); | ||
for (const item of arr) { | ||
const isUniq = result.every((v) => !areItemsEqual(v, item)); | ||
if (isUniq) { | ||
result.push(item); | ||
const key = mapper(item); | ||
if (!map.has(key)) { | ||
map.set(key, item); | ||
} | ||
} | ||
return result; | ||
return Array.from(map.values()); | ||
} | ||
// src/array/uniqBy.ts | ||
function uniqBy(arr, mapper) { | ||
return uniqWith(arr, (item1, item2) => mapper(item1) === mapper(item2)); | ||
} | ||
// Annotate the CommonJS export names for ESM import in node: | ||
@@ -45,0 +38,0 @@ 0 && (module.exports = { |
@@ -50,3 +50,3 @@ "use strict"; | ||
} | ||
return [...map.values()]; | ||
return Array.from(map.values()); | ||
} | ||
@@ -53,0 +53,0 @@ |
@@ -272,3 +272,3 @@ "use strict"; | ||
} | ||
return [...map.values()]; | ||
return Array.from(map.values()); | ||
} | ||
@@ -295,3 +295,10 @@ | ||
function uniqBy(arr, mapper) { | ||
return uniqWith(arr, (item1, item2) => mapper(item1) === mapper(item2)); | ||
const map = /* @__PURE__ */ new Map(); | ||
for (const item of arr) { | ||
const key = mapper(item); | ||
if (!map.has(key)) { | ||
map.set(key, item); | ||
} | ||
} | ||
return Array.from(map.values()); | ||
} | ||
@@ -298,0 +305,0 @@ |
{ | ||
"name": "es-toolkit", | ||
"description": "A state-of-the-art, high-performance JavaScript utility library with a small bundle size and strong type annotations.", | ||
"version": "1.3.1-dev.79+65a65ea2", | ||
"version": "1.3.1-dev.80+60e79741", | ||
"workspaces": [ | ||
@@ -6,0 +6,0 @@ "docs" |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
Manifest confusion
Supply chain riskThis package has inconsistent metadata. This could be malicious or caused by an error when publishing the package.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
Manifest confusion
Supply chain riskThis package has inconsistent metadata. This could be malicious or caused by an error when publishing the package.
Found 1 instance in 1 package
5501
511835