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

# toFilled (Functional Programming) es-toolkit

Creates a function that returns a filled copy of an array. Use it with [`pipe`](https://massaman.dev/reference/fp/pipe.md).

```typescript
const result = pipe(array, toFilled(value, start, end));
```

::: info

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

:::

## Usage

`toFilled` fills a copy of the piped array with `value` from `start` up to, but not including, `end`. It follows `Array.prototype.fill` index semantics and does not mutate the input array.

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

const array = [1, 2, 3, 4];

pipe(array, toFilled(0, 1, 3)); // => [1, 0, 0, 4]
array; // => [1, 2, 3, 4]
```

#### Parameters


valueUrequired

The value to write into the returned array.


startnumber, optionalrequired

The start index. Defaults to `0`.


endnumber, optionalrequired

The end index. Defaults to the array length.

#### Returns

A function that maps a `readonly T[]` to a filled copy.

```typescript
(array: readonly T[]) => Array<T | U>
```


Source: es-toolkit

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