> 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.

# isSubsetWith (Functional Programming) es-toolkit

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

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

::: info

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

:::

## Usage

`isSubsetWith` returns `true` when every value in the piped array matches at least one value in `superset` according to `areItemsEqual`.

```typescript
import { isSubsetWith, pipe } from 'es-toolkit/fp';

pipe(
  [{ id: 1 }],
  isSubsetWith([{ id: 1 }, { id: 2 }], (a, b) => a.id === b.id)
); // => true
```

#### Parameters


supersetreadonly T[]required

The array that may contain all values from the piped array.


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

The function that decides whether two values are equal.

#### Returns

A function that maps a `readonly T[]` to whether it is a subset.

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


Source: es-toolkit

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