es-toolkit
Version:
A state-of-the-art, high-performance JavaScript utility library with a small bundle size and strong type annotations.
32 lines • 1.22 kB
text/typescript
//#region src/compat/math/rangeRight.d.ts
/**
* Creates an array of numbers from `start` to `end` with optional `step`.
* @param start - The starting number of the range (inclusive).
* @param [end] - The end number of the range (exclusive).
* @param [step] - The step value for the range.
* @returns An array of numbers from `start` to `end` with the specified `step`.
* @example
* // Returns [0, 1, 2, 3]
* rangeRight(4);
* @example
* // Returns [0, 2, 4, 6]
* rangeRight(0, 8, 2);
* @example
* // Returns [5, 4, 3, 2, 1]
* rangeRight(1, 6);
*/
declare function rangeRight(start: number, end?: number, step?: number): number[];
/**
* Creates an array of numbers from 0 to `end` with step 1.
* Used when called as an iteratee for methods like `_.map`.
* @param end - The end number of the range (exclusive).
* @param index - The index parameter (used for iteratee calls).
* @param guard - The guard parameter (used for iteratee calls).
* @returns An array of numbers from 0 to `end` with step 1.
* @example
* // Returns [0, 1, 2, 3]
* rangeRight(4, 'index', {});
*/
declare function rangeRight(end: number, index: string | number, guard: object): number[];
//#endregion
export { rangeRight };