@newdash/newdash
Version:
javascript/typescript utility library
33 lines (32 loc) • 789 B
TypeScript
/**
* Fills elements of `array` with `value` from `start` up to, but not
* including, `end`.
*
* **Note:** This method mutates `array`.
*
* @static
* @since 5.10.0
* @category Array
* @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 Returns `array`.
* @example
*
* ```js
* var array = [1, 2, 3];
*
* fill(array, 'a');
* console.log(array);
* // => ['a', 'a', 'a']
*
* fill(Array(3), 2);
* // => [2, 2, 2]
*
* fill([4, 6, 8, 10], '*', 1, 3);
* // => [4, '*', '*', 10]
* ```
*/
export declare function fill<T>(array: Array<any>, value?: T): Array<T>;
export declare function fill(array: Array<any>, value?: any, start?: number, end?: number): Array<any>;