rangeRight (for BigInts) es-toolkit
Returns the same BigInts as range, but in descending order.
This function is available exclusively from es-toolkit/bigint to avoid potential conflicts with similar functions for other numeric types.
Usage
rangeRight(end)
Use rangeRight with one argument to count down from just below the end value to 0n.
Parameters
The end of the range, exclusive.
Returns
Returns an array of BigInts from just below end down to 0n.
rangeRight(start, end)
Use rangeRight with two arguments to count down to a start value other than 0n.
Parameters
The start of the range, inclusive.
The end of the range, exclusive.
Returns
Returns an array of BigInts from just below end down to start.
rangeRight(start, end, step)
Use rangeRight with three arguments to step by something other than 1n. The values are exactly those of range with the same arguments, reversed.
If the step points away from the end value, there is nothing to produce and you get an empty array.
Parameters
The start of the range, inclusive.
The end of the range, exclusive.
The amount to count by. Defaults to 1n.
Returns
Returns the values of range(start, end, step) in descending order.
Throws
Throws an error if step is 0n.
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.