uniqWith es-toolkit
Returns a new array with duplicate elements removed using a comparison function.
Usage
uniqWith(arr, areItemsEqual)
Use uniqWith when you want to remove duplicates based on a custom comparison function that determines if two elements are equal. It only keeps the first occurrence among elements for which the comparison function returns true.
Complex object comparisons are also possible.
Parameters
The array from which to remove duplicates.
A comparison function that determines if two elements are equal. It should return true if the elements are considered equal, and false otherwise.
Returns
A new array with duplicates removed based on the comparison function. Preserves the order in which they first appear in the original array.
Source: es-toolkit
Re-exported verbatim from es-toolkit. Implementation, edge cases, and performance behavior are owned upstream. This page mirrors the documentation at the pinned version; the linked source is authoritative.