> For AI agents: the complete documentation index is available at https://massaman.dev/llms.txt, the full documentation bundle is available at https://massaman.dev/llms-full.txt.

# uniqWith (Functional Programming) es-toolkit

Creates a function that removes duplicates using a custom equality function. Use it with [`pipe`](https://massaman.dev/reference/fp/pipe.md).

```typescript
const result = pipe(array, uniqWith(areItemsEqual));
```

::: info

Prefer the original es-toolkit [`uniqWith`](https://massaman.dev/reference/array/uniqWith.md) in ordinary code. Use this `fp` variant when composing transformations with [`pipe`](https://massaman.dev/reference/fp/pipe.md).

:::

## Usage

`uniqWith` keeps the first value that does not match a previously kept value according to `areItemsEqual`. It is lazy-capable inside [`pipe`](https://massaman.dev/reference/fp/pipe.md).

```typescript
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 }]
```

#### Parameters


areItemsEqual(item: T, other: T) => booleanrequired

The function that decides whether two values are equal.

#### Returns

A function that maps a `readonly T[]` to a duplicate-free array by custom equality.

```typescript
(array: readonly T[]) => T[]
```


Source: es-toolkit

Re-exported verbatim from [`es-toolkit`](https://es-toolkit.dev/fp/reference/uniqWith.html). Implementation, edge cases, and performance behavior are owned upstream. This page mirrors the documentation at the pinned version; the linked source is authoritative.
