docs/fp/reference/uniqWith.md
Creates a function that removes duplicates using a custom equality function. Use it with pipe.
const result = pipe(array, uniqWith(areItemsEqual));
::: info
Prefer the original es-toolkit uniqWith in ordinary code. Use this fp variant when composing transformations with pipe.
:::
uniqWith keeps the first value that does not match a previously kept value according to areItemsEqual. It is lazy-capable inside pipe.
import { pipe, uniqWith } from 'es-toolkit/fp';
pipe(
[{ id: 1 }, { id: 1 }, { id: 2 }],
uniqWith((a, b) => a.id === b.id)
); // => [{ id: 1 }, { id: 2 }]
areItemsEqual ((item: T, other: T) => boolean): The function that decides whether two values are equal.((array: readonly T[]) => T[]): A function that maps a readonly T[] to a duplicate-free array by custom equality.