toFilled es-toolkit
Creates a new array by filling part or all of it with the specified value.
Usage
toFilled(arr, value, start?, end?)
Use toFilled when you want to fill a specific range of an array with a specified value. It creates and returns a new array without modifying the original array.
If you omit the start and end positions, it fills the entire array.
You can also use negative indices. They count from the end of the array.
Parameters
The original array to base on.
The value to fill the array with.
The start position for filling. Default is 0.
The end position for filling. Default is the array length.
Returns
Returns a new array with the specified range filled with the value. The original array is not modified.
Source: es-toolkit
Re-exported verbatim from es-toolkit. Implementation, edge cases, and performance behavior are owned upstream. This page mirrors the documentation at the pinned version; the linked source is authoritative.