super-utils-plus
Version:
A superior alternative to Lodash with improved performance, TypeScript support, and developer experience
23 lines (22 loc) • 565 B
TypeScript
/**
* Fills elements of array with value from start up to, but not including, end.
*
* @param array - The array to fill
* @param value - The value to fill array with
* @param start - The start position
* @param end - The end position
* @returns The filled array
*
* @example
* ```ts
* fill([1, 2, 3], 'a');
* // => ['a', 'a', 'a']
*
* fill(Array(3), 2);
* // => [2, 2, 2]
*
* fill([4, 6, 8, 10], '*', 1, 3);
* // => [4, '*', '*', 10]
* ```
*/
export declare function fill<T, U>(array: T[], value: U, start?: number, end?: number): Array<T | U>;