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

# zipWith (Functional Programming) es-toolkit

Creates a function that combines values from arrays by index. Use it with [`pipe`](https://massaman.dev/reference/fp/pipe.md).

```typescript
const result = pipe(array, zipWith(...arrs, combine));
```

::: info

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

:::

## Usage

`zipWith` passes values at the same index from the piped array and configured arrays to `combine`. If arrays have different lengths, missing values are passed as `undefined`.

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

pipe(
  [1, 2],
  zipWith([10, 20], (a, b) => a + b)
); // => [11, 22]

pipe(
  [1, 2, 3],
  zipWith([10], (a, b = 0) => a + b)
); // => [11, 2, 3]
```

#### Parameters


arrsArray<readonly unknown[]>required

The arrays to combine with the piped array.


combine(...values: unknown[]) => Rrequired

The function that receives values at the same index, followed by the index, and returns a new value.

#### Returns

A function that maps the piped array to combined values.

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


Source: es-toolkit

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